Class Paths
Helper methods for resolving file system paths.
public static class Paths
- Inheritance
-
objectPaths
Methods
Absolute(string)
Returns the absolute path for the specified path string.
public static string Absolute(string path)
Parameters
pathstring
Returns
Exceptions
- IOException
The
pathcontains invalid characters.
Combine(params string[])
Combines an array of strings into a path.
public static string Combine(params string[] paths)
Parameters
pathsstring[]
Returns
Exceptions
- IOException
One of the strings in the array contains invalid characters.
FileName(string)
Returns the file name portion of the specified path string.
public static string FileName(string path)
Parameters
pathstring
Returns
Exceptions
- IOException
The
pathcontains invalid characters.
IsAbsolute(string)
Indicates whether the specified path string is an absolute path.
public static bool IsAbsolute(string path)
Parameters
pathstring
Returns
Exceptions
- IOException
The
pathcontains invalid characters.
Parent(string)
Returns the absolute path of the parent directory of the specified path string.
public static string Parent(string path)
Parameters
pathstring
Returns
Exceptions
- IOException
The
pathcontains invalid characters.
ResolveFiles(IEnumerable<string>, string)
Resolves paths to absolute file paths with wildcard support.
public static IList<FileInfo> ResolveFiles(IEnumerable<string> paths, string defaultPattern = "*")
Parameters
pathsIEnumerable<string>The paths to resolve.
defaultPatternstringThe default pattern to use for finding files when a directory is specified.
Returns
Remarks
paths are first interpreted as files, then as directories. Directories are searched using the defaultPattern. * and ? characters are considered as wildcards.
Exceptions
- FileNotFoundException
A file that was explicitly specified in
paths(no wildcards) could not be found.