1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Provides the directory of the executable.
use ;
/// 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 through `cargo run`.
/// See the [cargo reference documentation][cargo-ref] 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.
///
/// [cargo-ref]: https://doc.rust-lang.org/cargo/reference/environment-variables.html
/// [`std::env::current_exe`]: https://doc.rust-lang.org/std/env/fn.current_exe.html
/// Same as `application_root_dir`, but extends the root directory with the given path.