pub fn normalize_path(p: impl AsRef<Path>) -> PathBufExpand description
Normalizes a path by resolving relative components and performing some changes.
For Windows, any \\?\X:, X:, or \\?\UNC\ prefixes are ensured
to be uppercase and UNC host names and rest characters are always returned in lowercase form.
ⓘ
assert_eq!(PathBuf::from_str(r"\\?\C:\program files").unwrap(), normalize_path(r"C:/Program Files/"));
assert_eq!(PathBuf::from_str(r"\\?\UNC\server\foo").unwrap(), normalize_path(r"\\server\foo\"));
assert_eq!(PathBuf::from_str(r"\\?\C:\foo").unwrap(), normalize_path(r"\\?\c:/foo/"));
assert_eq!(PathBuf::from_str(r"\\?\UNC\server\foo").unwrap(), normalize_path(r"\\?\unc\server\Foo\"));
assert_eq!(PathBuf::from_str(r"\\?\C:").unwrap(), normalize_path(r"\\?\C:\\"));
assert_eq!(PathBuf::from_str(r"\\?\C:").unwrap(), normalize_path(r"\\?\C:"));