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

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

Properties

ContainsDrive

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

ContainsFile

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

Extension

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

File

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

Folders

#
public string[] Folders { get; }
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.

IsAbsolute

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

IsRelative

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

Methods

Equals

#
public bool Equals(FileSystemPath other)
other (FileSystemPath)

Equals

#
public override bool Equals(object obj)
obj (object)
Object.Equals

GetHashCode

#
public override int GetHashCode()

MakeAbsolute

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

MakeRelative

#
public static FileSystemPath MakeRelative(FileSystemPath a, FileSystemPath b)
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.
a (FileSystemPath)Absolute departure.
b (FileSystemPath)Absolute terminal.
A relative path encoding the difference from a to b, or just b.

ToString

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

ToString

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

WithFile

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

WithoutFile

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