standardizingPath
A new string made by removing extraneous path components from the receiver.
Declaration
var standardizingPath: String { get }Discussion
A new string made by performing the following operations:
Expanding an initial tilde expression using expandingTildeInPath.
Removing an initial component of “
/private/var/automount”, “/var/automount”, or “/private” from the path, if the result still indicates an existing file or directory (checked by consulting the file system).Reducing empty components and references to the current directory (that is, the sequences “//” and “/./”) to single path separators.
Removing a trailing slash from the last component.
For absolute paths only, resolving references to the parent directory (that is, the component “..”) to the real parent directory if possible using resolvingSymlinksInPath. For relative paths, references to the parent directory are left in place.
Returns self if an error occurs.
Note that the path returned by this method may still have symbolic link components in it. Note also that this method only works with file paths (not, for example, string representations of URLs).
See Also
Working with Paths
path(withComponents:)pathComponentscompletePath(into:caseSensitive:matchesInto:filterTypes:)fileSystemRepresentationgetFileSystemRepresentation(_:maxLength:)isAbsolutePathlastPathComponentpathExtensionabbreviatingWithTildeInPathappendingPathComponent(_:)appendingPathExtension(_:)deletingLastPathComponentdeletingPathExtensionexpandingTildeInPathresolvingSymlinksInPath