- Method normalize_path
string normalize_path(string path)
Normalize an existing Windows file system path.
The following transformations are currently done:
Forward slashes (
'/') are converted to backward slashes (
Trailing slashes are removed, except a single slash after a drive letter (e.g.
"C:\"is returned instead of
Extraneous empty extensions are removed.
Short filenames are expanded to their corresponding long variants.
Relative paths are expanded to absolute paths.
Current- and parent-directory path components (
"..") are followed, similar to combine_path.
Case-information in directory and file names is restored.
Drive letters are returned in uppercase.
The host and share parts of UNC paths are returned in lowercase.
A normalized absolute path without trailing slashes.
Throws errors on failure, e.g. if the file or directory doesn't exist.
File fork information is currently not supported (invalid data).
In Pike 7.6 and earlier, this function didn't preserve a single slash after drive letters, and it didn't convert the host and share parts of an UNC path to lowercase.
- See also