Skip to main content

is_network_path

Function is_network_path 

Source
pub fn is_network_path(path: &Path) -> bool
Expand description

Whether path sits on a network filesystem, according to the mount table.

Takes the longest mount point that is a prefix of the path. Returns false wherever the mount table is unavailable or unparseable, so this is a hint and never a gate.

The table comes from crate::locality::Mounts::cached rather than from a fresh read, because this is asked per row: once by annotate for every row of a listing, and again by unmeasured_visible for every row on every frame that draws one. Five thousand rows on a network share meant five thousand reads of /proc/self/mountinfo per frame — a hundred milliseconds on the thread that draws, which is the whole of why browsing a large remote directory crawled.