app_root_folder 0.1.0

Get the path to the app root folder
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::env;
use std::path::PathBuf;

/// Path to the executable.
pub type ExecutablePath = PathBuf;

/// Returns the path to the executable.
///
/// Fails if the executable does not exist.
pub fn get_executable_path() -> ExecutablePath {
    let executable = env::current_exe().unwrap();

    if !executable.exists() {
        panic!("The executable does not exist: {:?}", executable);
    }

    executable
}