[−][src]Function amethyst_utils::app_root_dir::application_root_dir
pub fn application_root_dir() -> Result<PathBuf, Error>
Returns the cargo manifest directory when running the executable with cargo or the directory in which the executable resides otherwise, traversing symlinks if necessary.
The algorithm used is:
- If the
CARGO_MANIFEST_DIR
environment variable is defined it is used as application root. This simplifies running development projects throughcargo run
. See the cargo reference documentation for more details. - If the executable name can be found using
std::env::current_exe
, resolve all symlinks and use the directory it resides in as application root.
If none of the above works, an error is returned.