Skip to main content

normalize_path

Function normalize_path 

Source
pub fn normalize_path(path: &str) -> Cow<'_, str>
Expand description

Normalises a path string to use forward slashes and consistent drive-letter casing so that pathdiff::diff_paths works correctly in Wasm / cross-platform contexts where Windows-style paths may arrive from the JS host.

Borrows when the path is already normalised — the case for every POSIX path, and the allowlist is re-scanned for each compiled file, so allocating there would cost one String per entry per file.