Skip to main content

Module path_util

Module path_util 

Source
Expand description

Cross-platform path classification helpers. Cross-platform path classification helpers.

Rust’s std::path::Path::is_absolute uses platform-specific semantics: on Unix a path starting with / is absolute, while on Windows a path needs a drive prefix (C:\foo) or a UNC root (\\?\C:\foo). A POSIX-style absolute path like /project/foo.ts returns false from is_absolute() on Windows, which breaks code that conditionally joins relative paths against a root.

Use these helpers whenever input paths may originate from user-supplied data shared across CI runners, config files, source maps, or diff output.

Functions§

is_absolute_path_any_platform
Returns true if path is anchored under either platform’s path conventions.
looks_like_windows_absolute_path
Returns true if value looks like a Windows-style absolute path with a drive letter, colon, and path separator.