Provides path-related utilities.
string | |
Appends the specified value to the filename part before extension. |
string | |
Combines the full path containing the running executable with the specified string. Ensures that only a single
Path.DirectorySeparatorChar separates the two. |
string | |
Combines the full path containing the running executable with one or more strings. Ensures that only a single
Path.DirectorySeparatorChar separates the executable path and every string. |
string | Combine(string path1, string path2) |
Joins the two paths using the OS separator character. If the second path is absolute, only the second path is
returned. |
string | Combine(string path1, string path2, params string[] morepaths) |
Joins multiple paths using the OS separator character. If any of the paths is absolute, all preceding paths
are discarded. |
void | |
Creates all directories in the path to the specified file if they don't exist. Accepts filenames relative to
the current directory. |
void | |
Deletes the specified directory only if it is empty, and then checks all parents to see if they have become
empty too. If so, deletes them too. Does not throw any exceptions. |
string | |
Expands all occurrences of "$(NAME)" in the specified string with the special folder path for the current
machine/user. See remarks for details. |
IEnumerable<string> | ExpandWildcards(string filenameOrPattern, bool matchFiles = true, bool matchDirectories = false, bool includeSubdirectories = false) |
Given a filename or a pattern containing * or ? wildcards, enumerates all names matching the wildcard. |
string | |
Returns the name and extension of the last group in the specified path, separated by either of the two
slashes. |
string | |
Returns the "parent" path of the specified path by removing the last name from the path, separated by either
forward or backslash. If the original path ends in slash, the returned path will also end with a slash. |
string | |
Returns the "parent" path of the specified path by removing the last group from the path, separated by the
"separator" character. If the original path ends in slash, the returned path will also end with a slash. |
string | |
Returns the full path pointing to the same file/directory as path. Converts relative paths
to absolute paths where necessary, relative to the current working directory. This is the same as Path.GetFullPath(string), except that this function returns the actual on-disk capitalization for each
segment, regardless of how they are capitalized in path. If the path does not exist in
full, corrects the capitalization of the segments that do exist. Always capitalizes the drive letter. |
bool | | Checks whether subpath refers to a subdirectory inside parentPath. |
bool | |
Checks whether subpath refers to a subdirectory inside parentPath or the
same directory. |
string | |
Normalises the specified path. A "normalised path" is a path to a directory (not a file!) which always ends
with a slash. |
string | |
Strips a single trailing directory separator, whether it's the forward- or backslash. Preserves the single
separator at the end of paths referring to the root of a drive, such as "C:\". Removes at most a single
separator, never more. |
string | |
Changes a relative toggledPath to an absolute and vice versa, with respect to basePath. Neither path must be an empty string. Any trailing slashes are ignored and the result won't
have one except for root "C:\"-style paths. Forward slashes, multiple repeated slashes, and any redundant "."
or ".." elements are correctly interpreted and eliminated. See Remarks for some special cases. |
string | |
Checks to see whether the specified path starts with any of the standard paths supported by PathUtil.ExpandPath(string), and if so, replaces the prefix with a "$(NAME)" string and returns the resulting value.
The value passed in should be an absolute path for the substitution to work. |