Module std.path
This module is used to manipulate path strings.
All functions, with the exception of expandTilde (and in some
    cases absolutePath and relativePath), are pure
    string manipulation functions; they don't depend on any state outside
    the program, nor do they perform any actual file system actions.
    This has the consequence that the module does not make any distinction
    between a path that points to a directory and a path that points to a
    file, and it does not know whether or not the object pointed to by the
    path actually exists in the file system.
    To differentiate between these cases, use isDir and
    exists.
    Note that on Windows, both the backslash (\/buildNormalizedPath
    function will replace all slashes with backslashes on that platform.
    In general, the functions in this module assume that the input paths
    are well-formed.  (That is, they should not contain invalid characters,
    they should follow the file system's path format, etc.)  The result
    of calling a function on an ill-formed path is undefined.  When there
    is a chance that a path or a file name is invalid (for instance, when it
    has been input by the user), it may sometimes be desirable to use the
    isValidFilename and isValidPath functions to check
    this.
Most functions do not perform any memory allocations, and if a string is returned, it is usually a slice of an input string. If a function allocates, this is explicitly mentioned in the documentation.
| Category | Functions | 
|---|---|
| Normalization | absolutePathasAbsolutePathasNormalizedPathasRelativePathbuildNormalizedPathbuildPathchainPathexpandTilde | 
| Partitioning | baseNamedirNamedirSeparatordriveNamepathSeparatorpathSplitterrelativePathrootNamestripDrive | 
| Validation | isAbsoluteisDirSeparatorisRootedisValidFilenameisValidPath | 
| Extension | defaultExtensionextensionsetExtensionstripExtensionwithDefaultExtensionwithExtension | 
| Other | filenameCharCmpfilenameCmpglobMatchCaseSensitive | 
Functions
| Name | Description | 
|---|---|
| 
									absolutePath(path, base)
								 | Transforms pathinto an absolute path. | 
| 
									asAbsolutePath(path)
								 | Transforms pathinto an absolute path. | 
| 
									asNormalizedPath(path)
								 | Normalize a path by resolving current/parent directory
    symbols ( "."and"..") and removing superfluous
    directory separators.
    It will return "." if the path leads to the starting directory.
    On Windows, slashes are replaced with backslashes. | 
| 
									asRelativePath(path, base)
								 | Transforms pathinto a path relative tobase. | 
| 
									baseName(path)
								 | |
| 
									buildNormalizedPath()
								 | Performs the same task as buildPath,
    while at the same time resolving current/parent directory
    symbols ("."and"..") and removing superfluous
    directory separators.
    It will return "." if the path leads to the starting directory.
    On Windows, slashes are replaced with backslashes. | 
| 
									buildPath(segments)
								 | Combines one or more path segments. | 
| 
									chainPath(r1, r2, ranges)
								 | Concatenate path segments together to form one path. | 
| 
									defaultExtension(path, ext)
								 | |
| 
									dirName(path)
								 | Returns the parent directory of path. On Windows, this
    includes the drive letter if present. Ifpathis a relative path and
    the parent directory is the current working directory, returns".". | 
| 
									driveName(path)
								 | Get the drive portion of a path. | 
| 
									expandTilde(inputPath)
								 | Performs tilde expansion in paths on POSIX systems. On Windows, this function does nothing. | 
| 
									extension(path)
								 | |
| 
									filenameCharCmp(a, b)
								 | Compares filename characters. | 
| 
									filenameCmp(filename1, filename2)
								 | Compares file names and returns | 
| 
									globMatch(path, pattern)
								 | Matches a pattern against a path. | 
| 
									isAbsolute(path)
								 | Determines whether a path is absolute or not. | 
| 
									isDirSeparator(c)
								 | Determines whether the given character is a directory separator. | 
| 
									isRooted(path)
								 | Determines whether a path starts at a root directory. | 
| 
									isValidFilename(filename)
								 | Checks that the given file or directory name is valid. | 
| 
									isValidPath(path)
								 | Checks whether pathis a valid path. | 
| 
									pathSplitter(path)
								 | Slice up a path into its elements. | 
| 
									relativePath(path, base)
								 | Translates pathinto a relative path. | 
| 
									rootName(path)
								 | Returns the root directory of the specified path, or nullif the
    path is not rooted. | 
| 
									setExtension(path, ext)
								 | Sets or replaces an extension. | 
| 
									stripDrive(path)
								 | Strips the drive from a Windows path. On POSIX, the path is returned unaltered. | 
| 
									stripExtension(path)
								 | Remove extension from path. | 
| 
									withDefaultExtension(path, ext)
								 | Set the extension of pathtoextifpathdoesn't have one. | 
| 
									withExtension(path, ext)
								 | Replace existing extension on filespec with new one. | 
Enums
| Name | Description | 
|---|---|
| 
									CaseSensitive
								 | This enumis used as a template argument to functions which
    compare file names, and determines whether the comparison is
    case sensitive or not. | 
Manifest constants
| Name | Type | Description | 
|---|---|---|
| dirSeparator | String used to separate directory names in a path. Under POSIX this is a slash, under Windows a backslash. | |
| pathSeparator | Path separator string. A colon under POSIX, a semicolon under Windows. | 
Authors
Lars Tandle Kyllingstad, Walter Bright, Grzegorz Adam Hankiewicz, Thomas Kühne, Andrei Alexandrescu