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
trueifpathis anchored under either platform’s path conventions. - looks_
like_ windows_ absolute_ path - Returns
trueifvaluelooks like a Windows-style absolute path with a drive letter, colon, and path separator.