Skip to main content

find_tool

Function find_tool 

Source
pub fn find_tool(name: &str) -> Result<PathBuf, ToolError>
Expand description

Find an external program. A name with a path separator is used as given. Otherwise the first executable match wins, in this order: each PATH folder; the path where the tool was found last time, if it still exists and is executable; the platform’s usual install folders (super::FALLBACK_DIRECTORIES) that exist. The last two steps run only after super::apply: they use its cache file and its folders, so a test that never applies the startup PATH never finds a tool outside PATH. The last step also covers a start from a terminal whose PATH lacks, for example, Homebrew. A PATH or install-folder result is saved, as an absolute path, when it differs from the saved path; an install-folder result is logged once per tool.