process_path
is a crate that makes it easy to get the path of the currently executing process.
Thanks to Geoffroy Couprie for the idea!
take this, make it in a new useful library, be awesome: https://t.co/4aDY9wp9Np
— Geoffroy Couprie (@gcouprie) December 22, 2016
you have until I get back from vacation ;)
The library currently provides one function:
pub fn get_executable_path() -> Option<PathBuf>;
The library uses various platform specific APIs to find the appropriate path rather than relying on argv[0]
and supports the following platforms:
Platform | Underlying API |
---|---|
Linux | readlink(/proc/self/exe) |
macOS | _NSGetExecutablePath() |
Windows | GetModuleFileName() |
process_path
is available on crates.io.
Please submit suggestions, bugs, and feature requests to the GitHub repository or ping me on Twitter. Pull requests welcome 😀