Extension methods for
Normalizes a path using purely lexical analysis.
The following normalization rules are applied iteratively:
- Multiple contiguous path separators are replaced with a single
- Current directory components (
.) are removed.
- Parent directory components (
..) that do not occur at the beginning of the path are removed along with the preceding component.
- Parent directory components at the start of a rooted path
/..) are removed.
- Empty paths are replaced with “.”.
The returned path ends in a separator only if it represents the root directory.
This method is a port of Go’s