Function bitflags::__core::env::current_exe [] [src]

pub fn current_exe() -> Result<PathBuf, Error>
1.0.0

Returns the full filesystem path to the current running executable.

The path returned is not necessarily a "real path" to the executable as there may be intermediate symlinks.

Errors

Acquiring the path to the current executable is a platform-specific operation that can fail for a good number of reasons. Some errors can include, but not be limited to, filesystem operations failing or general syscall failures.

Examples

use std::env;

match env::current_exe() {
    Ok(exe_path) => println!("Path of this executable is: {}",
                              exe_path.display()),
    Err(e) => println!("failed to get current exe path: {}", e),
};