forked fromwesleywiser/process_path
- Notifications
You must be signed in to change notification settings - Fork0
A Rust library to get the path of the currently executing process
License
Apache-2.0, MIT licenses found
Licenses found
Apache-2.0
LICENSE-APACHEMIT
LICENSE-MITNotificationsYou must be signed in to change notification settings
talagrand/process_path
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Rust library to get the path of the currently executing process orthe the current dynamic library.
The latter is particularly useful for ‘plug-in‘ type dynamic librariesthat need to load resources stored relative to the location of thelibrary in the file system.
Add this to yourCargo.toml
:
[dependencies]process_path ="0.1.4"
and this to your crate root:
use process_path;
This program prints its path to stdout:
use process_path::get_executable_path;fnmain(){let path =get_executable_path();match path{None =>println!("The process path could not be determined"),Some(path) =>println!("{:?}", path)}}
Platform | Underlying APIget_executable_path() | get_dylib_path() |
---|---|---|
Linux | readlink(/proc/self/exe) | dladdr() |
FreeBSD | sysctl(3) orreadlink(/proc/curproc/file) | dladdr() |
NetBSD | readlink(/proc/curproc/exe) | dladdr() |
DragonflyBSD | readlink(/proc/curproc/file) | dladdr() |
macOS | _NSGetExecutablePath() | dladdr() |
Windows | GetModuleFileName() | GetModuleHandleEx() |
Copyright Wesley Wiser andprocess_path
contributors.
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE orhttp://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT orhttp://opensource.org/licenses/MIT)
at your option.
About
A Rust library to get the path of the currently executing process
Resources
License
Apache-2.0, MIT licenses found
Licenses found
Apache-2.0
LICENSE-APACHEMIT
LICENSE-MITStars
Watchers
Forks
Packages0
No packages published
Languages
- Rust100.0%