PathUtil::Normalize Method (String^)
Returns a normalized form of the given path.
Assembly: Microsoft.VisualStudio.Utilities (in Microsoft.VisualStudio.Utilities.dll)
Parameters
- path
-
Type:
System::String^
Path to normalize.
What it does:
Takes pains not to allocate extra temporary strings
Verifies that the path contains no invalid path characters, throwing an exception if any invalid characters are found
Strips leading and trailing whitespace
Replaces "/" with "\"
Replaces multiple consecutive "\" with a single "\", except for the leading "\\" of a UNC path
Removes the trailing "\", unless it's part of a root (e.g. "C:\")
Converts to lowercase
What it doesn't do:
Fully qualify a non-rooted filename (e.g. "dir\filename.ext")
Simplify relative pathnames (e.g. "C:\dir\..\FileInDriveRoot.ext"). It's tempting to use Path.GetFullPathName to perform this function, but that would entail an expensive trip to the disk or network.
Verify that the path exists.