Throws an Exception if an absolute path contains parent directory segments ("..") that lead to a path that is a parent path of the root path.
auto path = WindowsPath("C:\\test/foo/./bar///../baz"); path.normalize(); assert(path.toString() == "C:\\test\\foo\\baz", path.toString()); path = WindowsPath("foo/../../bar/"); path.normalize(); assert(path.toString() == "..\\bar\\");
Removes any redundant path segments and replaces all separators by the default one.
The resulting path representation is suitable for basic semantic comparison to other normalized paths.
Note that there are still ways for different normalized paths to represent the same file. Examples of this are the tilde shortcut to the home directory on Unix and Linux operating systems, symbolic or hard links, and possibly environment variables are examples of this.