Skip to main content

same_filesystem

Function same_filesystem 

Source
pub fn same_filesystem(a: &Path, b: &Path) -> Option<bool>
Expand description

Whether a and b sit on the same filesystem.

The destination normally does NOT exist yet — that is the whole point of asking before creating it — so each path is resolved to its deepest existing ancestor first. Stat-ing the destination itself would answer “unknown” for every question actually worth asking.

None off unix, where the standard library exposes no device id: a rename across filesystems fails where one within a filesystem does not, so a migration that assumed “same” would discover it at switch-over time. Saying “unknown” keeps that decision with the operator.