Skip to main content

classify_path

Function classify_path 

Source
pub fn classify_path(exe: &Path) -> InstallMethod
Expand description

Classify an executable path without touching the filesystem.

A node_modules directory anywhere above the binary means npm (or a compatible client) put it there. Nothing else in a normal install lands under such a directory; the sole way to be wrong is to unpack a release archive into a directory literally named node_modules, which costs the user nothing worse than being told to run npm update when they meant to self-update.

Both separators are split on, rather than using Path::components, which only understands the separator of the host it was compiled for. That keeps the classification — and its tests — identical everywhere, including when a Windows path is examined on a Unix host.