Skip to main content

resolve_on_path

Function resolve_on_path 

Source
pub fn resolve_on_path(path_var: Option<&OsStr>, bin: &str) -> Option<PathBuf>
Expand description

Resolve bin on a PATH-style value, returning the first matching file.

path_var is the raw PATH value (e.g. from std::env::var_os); it is split with std::env::split_paths, which honours the platform separator. For each directory we test dir/<bin><EXE_SUFFIX> and return the first entry that exists and is a file. A None / empty PATH resolves to None.