Skip to content
ConsoleMonster

API Reference

Class

DisplayPath

Namespace ConsoleMonster.Text
Assembly ConsoleMonster
Modifiers static

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) #
Returns: String

The last segment of a path, splitting on both \ and /.

Parameters

path System.String? requiredposition: 0
The path.

Returns

The file name, or the path itself when it has no separator.

IsForeign 2 overloads
public static Boolean IsForeign(String? path) #
Returns: Boolean

Whether 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? requiredposition: 0
The path.

Returns

True for a foreign path.

public static Boolean IsForeign(String? path, Boolean hostIsWindows) #
Returns: Boolean

Whether a path belongs to another kind of system than a host of the given kind.

Parameters

path System.String? requiredposition: 0
The path.
hostIsWindows System.Boolean requiredposition: 1
Whether the host is Windows.

Returns

True for a foreign path.

public static String Short(String path, String? basePath) #
Returns: String

A 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 requiredposition: 0
The path.
basePath System.String? requiredposition: 1
The base path, or null.

Returns

The short path.