Function dunce::simplified

source ·
pub fn simplified(path: &Path) -> &Path
Expand description

Takes any path, and when possible, converts Windows UNC paths to regular paths.

On non-Windows this is no-op.

\\?\C:\Windows will be converted to C:\Windows, but \\?\C:\COM will be left as-is (due to a reserved filename).

Use this to pass arbitrary paths to programs that may not be UNC-aware. It’s generally safe to pass UNC paths to legacy programs, because the paths contain a reserved character, so will gracefully fail if used with wrong APIs.

This function does not perform any I/O.

Currently paths with unpaired surrogates aren’t converted even if they can be due to limitations of Rust’s OsStr API.