API Reference
DisplayPath
Paths for display that may come from another system: recorded test runs, imported stack traces and error records carry Windows paths that a Unix host's path APIs would not split (a backslash is not a separator there), and the reverse. These helpers work on the text of the path, so the same path looks the same on every host; paths that belong to the host still go through its own path APIs for I/O.
Inheritance
- Object
- DisplayPath
Methods
public static String FileName(String? path) #StringThe last segment of a path, splitting on both \ and /.
Parameters
- path System.String?
- The path.
Returns
The file name, or the path itself when it has no separator.
public static Boolean IsForeign(String? path) #BooleanWhether a path belongs to another kind of system than the current host (a drive or UNC path on Unix, a rooted Unix path on Windows).
Parameters
- path System.String?
- The path.
Returns
True for a foreign path.
public static Boolean IsForeign(String? path, Boolean hostIsWindows) #BooleanWhether a path belongs to another kind of system than a host of the given kind.
Parameters
- path System.String?
- The path.
- hostIsWindows System.Boolean
- Whether the host is Windows.
Returns
True for a foreign path.
public static String Short(String path, String? basePath) #StringA short form of a path as text: relative to basePath when under it (compared without regard to case or separator style), otherwise its folder and file name, keeping the path's own separator.
Parameters
- path System.String
- The path.
- basePath System.String?
- The base path, or null.
Returns
The short path.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?