FileSystemPath

References
An absolute or relative path on a file system. This type re-implements some functionality normally provided by the Uri type, but it does so in a reliable, and cross-platform consistent way.

Constructors

FileSystemPath

#
Create a new path from a textual uri.
public FileSystemPath(
path
Path. If the path is supposed to represent a folder, it *must* end with a directory separator character.
)

Properties

ContainsDrive

#
Test whether the first element in the folder list probably represents a drive identifier.
public bool ContainsDrive { get; }

ContainsFile

#
Gets whether this path points to a file.
public bool ContainsFile { get; }

Extension

#
Gets the file extension, including the dot. This may be an empty string.
public string Extension { get; }

File

#
Gets the file name. This may be an empty string is the path represents a folder.
public string File { get; }

Folders

#
A list of path (i.e. drive and directory) elements. This does not include the file name or file extension, and the first element may be an empty string in the case the path starts with a directory separator character (i.e. a Unix root). If you modify the elements in this array it may render the path invalid.
public string[] Folders { get; }

IsAbsolute

#
Gets whether this is an absolute path.
public bool IsAbsolute { get; }

IsRelative

#
Gets whether this is a relative path.
public bool IsRelative { get; }

Methods

Equals

#
public bool Equals()

Equals

#
public override bool Equals(
obj
)
Object.Equals

GetHashCode

#
public override int GetHashCode()

MakeAbsolute

#
Create an absolute path from a relative path and a starting point.
public static FileSystemPath MakeAbsolute(
from,
Relative path to resolve.
origin
Absolute starting point.
)
An absolute path.

MakeRelative

#
Create a relative path between two absolute paths. If there is no relative path from 'a' to 'b' because they have nothing in common, 'b' is returned.
public static FileSystemPath MakeRelative(
a,
Absolute departure.
b
Absolute terminal.
)
A relative path encoding the difference from a to b, or just b.

ToString

#
Create a string representation of this path using the current OSs directory separator symbols.
public override string ToString()
Object.ToString

ToString

#
Create a string representation of this path using custom separator symbols.
public string ToString(
directorySeparator,
Separator string between directories.
fileSeparator
Separator string between final directory and file.
)

WithFile

#
Set new file data to this path.
public FileSystemPath WithFile(
name,
File name.
extension
File extension, including the dot.
)

WithoutFile

#
Strip the file data from this path.
public FileSystemPath WithoutFile()