#dylib #dll #process #current #executable

process_path

Gets the path of the currently executing process or dynamic library

4 releases

0.1.4 Jun 27, 2022
0.1.3 Jan 7, 2021
0.1.1 Jan 4, 2017
0.1.0 Jan 4, 2017

#421 in Filesystem

Download history 12199/week @ 2026-02-02 9519/week @ 2026-02-09 11431/week @ 2026-02-16 12267/week @ 2026-02-23 9382/week @ 2026-03-02 12217/week @ 2026-03-09 13403/week @ 2026-03-16 15598/week @ 2026-03-23 15647/week @ 2026-03-30 12178/week @ 2026-04-06 14647/week @ 2026-04-13 13936/week @ 2026-04-20 13860/week @ 2026-04-27 13918/week @ 2026-05-04 14559/week @ 2026-05-11 11543/week @ 2026-05-18

54,325 downloads per month
Used in 16 crates (15 directly)

MIT/Apache

13KB
212 lines

process_path

A Rust library to get the path of the currently executing process or the the current dynamic library.

The latter is particularly useful for ‘plug-in‘ type dynamic libraries that need to load resources stored relative to the location of the library in the file system.

Usage

Add this to your Cargo.toml:

[dependencies]
process_path = "0.1.4"

and this to your crate root:

use process_path;

Example

This program prints its path to stdout:

use process_path::get_executable_path;

fn main() {
    let path = get_executable_path();
    match path {
        None => println!("The process path could not be determined"),
        Some(path) => println!("{:?}", path)
    }
}

Supported Platforms

Platform Underlying API get_executable_path() get_dylib_path()
Linux readlink(/proc/self/exe) dladdr()
FreeBSD sysctl(3) or readlink(/proc/curproc/file) dladdr()
NetBSD readlink(/proc/curproc/exe) dladdr()
DragonflyBSD readlink(/proc/curproc/file) dladdr()
macOS _NSGetExecutablePath() dladdr()
Windows GetModuleFileName() GetModuleHandleEx()

License

Copyright Wesley Wiser and process_path contributors.

Licensed under either of

at your option.

Dependencies

~185KB