Joutsen v0.5.0+12-g5dd5f7e
Public Member Functions | Static Public Member Functions | Properties | List of all members
Joutsen.IO.LocalFilesystemPath Class Reference

A class representing a path leading to elements of the filesystem. More...

Public Member Functions

 LocalFilesystemPath (string path)
 Creates a new instance of this class. More...
 
void Create ()
 Creates the entire path by creating all the folders belonging to it. More...
 
LocalFilesystemPath Extend (string additionalPath)
 Extends the current path by an additional folder, file or path represented by a string. More...
 
LocalFilesystemPath Extend (LocalFilesystemPath additionalPath)
 Extends the current path by an additional path. More...
 
File GetAsFile ()
 Fetches the file located at this path. More...
 
Folder GetAsFolder ()
 Fetches the folder located at this path. More...
 
override bool Equals (object obj)
 Compares this instance to another one for equality. More...
 
override int GetHashCode ()
 Calculates the hash code for this instance. More...
 
override string ToString ()
 Creates a string representation of this folder instance. More...
 
int CompareTo (object obj)
 
void Create ()
 Creates the entire path by creating all the folders belonging to it. More...
 
FilesystemPath Extend (string additionalPath)
 Extends the current path by an additional folder, file or path represented by a string. More...
 
FilesystemPath Extend (FilesystemPath additionalPath)
 Extends the current path by an additional path. More...
 
File GetAsFile ()
 Fetches the file located at this path. More...
 
Folder GetAsFolder ()
 Fetches the folder located at this path. More...
 

Static Public Member Functions

static LocalFilesystemPath operator+ (LocalFilesystemPath path, string additionalPath)
 Extends the current path by an additional folder, file or path represented by a string. More...
 
static LocalFilesystemPath operator+ (LocalFilesystemPath path, LocalFilesystemPath additionalPath)
 Extends the current path by an additional path. More...
 
static LocalFilesystemPath operator/ (LocalFilesystemPath path, string additionalPath)
 Extends the current path by an additional path. More...
 
static LocalFilesystemPath operator/ (LocalFilesystemPath path, LocalFilesystemPath additionalPath)
 Extends the current path by an additional path. More...
 
static String GetDirectoryName (String path)
 
static String Normalize (String path)
 

Properties

bool Exists [get]
 Checks if the path exists on the filesystem. More...
 
bool IsFolder [get]
 Checks if the path leads to a folder in the filesystem or could lead to one (if it does not exist). More...
 
bool IsFile [get]
 Checks if the path leads to a file in the filesystem or could lead to one (if it does not exist). More...
 
LocalFilesystemPath Root [get]
 Returns the root of the path. More...
 
LocalFilesystemPath ParentPath [get]
 Returns the path representing the parent of the current path. More...
 
string AbsolutePath [get]
 Fetches the absolute path represented by this path. More...
 
string[] Components [get]
 Returns the components (the folders that make up this path) of the path as a list. More...
 
- Properties inherited from Joutsen.IO.FilesystemPath
bool Exists [get]
 Checks if the path exists on the filesystem. More...
 
bool IsFolder [get]
 Checks if the path leads to a folder in the filesystem. More...
 
bool IsFile [get]
 Checks if the path leads to a file in the filesystem. More...
 
FilesystemPath Root [get]
 Returns the root of the path. More...
 
FilesystemPath ParentPath [get]
 Returns the path representing the parent of the current path. More...
 
string AbsolutePath [get]
 Fetches the absolute path represented by this path. More...
 
string[] Components [get]
 Returns the components (the folders that make up this path) of the path as a list. More...
 

Detailed Description

A class representing a path leading to elements of the filesystem.

Remarks
This class can handle forward and backward slashes as separators. It can also handle relative and absolute paths.

Constructor & Destructor Documentation

◆ LocalFilesystemPath()

Joutsen.IO.LocalFilesystemPath.LocalFilesystemPath ( string  path)

Creates a new instance of this class.

Parameters
paththe path represented as a string
Since
0.4.0

Member Function Documentation

◆ CompareTo()

int Joutsen.IO.LocalFilesystemPath.CompareTo ( object  obj)

◆ Create()

void Joutsen.IO.LocalFilesystemPath.Create ( )

Creates the entire path by creating all the folders belonging to it.

Remarks
This method creates only folders and should therefore not be used with file paths.
Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ Equals()

override bool Joutsen.IO.LocalFilesystemPath.Equals ( object  obj)

Compares this instance to another one for equality.

Parameters
objthe instance to check for equality
Since
0.4.0

◆ Extend() [1/2]

LocalFilesystemPath Joutsen.IO.LocalFilesystemPath.Extend ( LocalFilesystemPath  additionalPath)

Extends the current path by an additional path.

Parameters
additionalPaththe path to add
Returns
a new path representing the combined paths
Since
0.4.0

◆ Extend() [2/2]

LocalFilesystemPath Joutsen.IO.LocalFilesystemPath.Extend ( string  additionalPath)

Extends the current path by an additional folder, file or path represented by a string.

Parameters
additionalPaththe path to add
Returns
a new path representing the combined paths
Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ GetAsFile()

File Joutsen.IO.LocalFilesystemPath.GetAsFile ( )

Fetches the file located at this path.

Returns
the File instance representing the file in the filesystem or null if the path leads to a folder
Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ GetAsFolder()

Folder Joutsen.IO.LocalFilesystemPath.GetAsFolder ( )

Fetches the folder located at this path.

Returns
the Folder instance representing the folder in the filesystem or null if the path leads to a file
Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ GetDirectoryName()

static String Joutsen.IO.LocalFilesystemPath.GetDirectoryName ( String  path)
static

◆ GetHashCode()

override int Joutsen.IO.LocalFilesystemPath.GetHashCode ( )

Calculates the hash code for this instance.

Since
0.4.0

◆ Normalize()

static String Joutsen.IO.LocalFilesystemPath.Normalize ( String  path)
static

◆ operator+() [1/2]

static LocalFilesystemPath Joutsen.IO.LocalFilesystemPath.operator+ ( LocalFilesystemPath  path,
LocalFilesystemPath  additionalPath 
)
static

Extends the current path by an additional path.

Parameters
additionalPaththe path to add
Returns
a new path representing the combined paths
Remarks
See also the Extend method.
Since
0.4.0

◆ operator+() [2/2]

static LocalFilesystemPath Joutsen.IO.LocalFilesystemPath.operator+ ( LocalFilesystemPath  path,
string  additionalPath 
)
static

Extends the current path by an additional folder, file or path represented by a string.

Parameters
additionalPaththe path to add
Returns
a new path representing the combined paths
Remarks
See also the Extend method.
Since
0.4.0

◆ operator/() [1/2]

static LocalFilesystemPath Joutsen.IO.LocalFilesystemPath.operator/ ( LocalFilesystemPath  path,
LocalFilesystemPath  additionalPath 
)
static

Extends the current path by an additional path.

Parameters
additionalPaththe path to add
Returns
a new path representing the combined paths
Remarks
See also the Extend method.
Since
0.4.0

◆ operator/() [2/2]

static LocalFilesystemPath Joutsen.IO.LocalFilesystemPath.operator/ ( LocalFilesystemPath  path,
string  additionalPath 
)
static

Extends the current path by an additional path.

Parameters
additionalPaththe path to add
Returns
a new path representing the combined paths
Remarks
See also the Extend method.
Since
0.4.0

◆ ToString()

override string Joutsen.IO.LocalFilesystemPath.ToString ( )

Creates a string representation of this folder instance.

Since
0.4.0

Property Documentation

◆ AbsolutePath

string Joutsen.IO.LocalFilesystemPath.AbsolutePath
get

Fetches the absolute path represented by this path.

Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ Components

string [] Joutsen.IO.LocalFilesystemPath.Components
get

Returns the components (the folders that make up this path) of the path as a list.

Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ Exists

bool Joutsen.IO.LocalFilesystemPath.Exists
get

Checks if the path exists on the filesystem.

Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ IsFile

bool Joutsen.IO.LocalFilesystemPath.IsFile
get

Checks if the path leads to a file in the filesystem or could lead to one (if it does not exist).

Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ IsFolder

bool Joutsen.IO.LocalFilesystemPath.IsFolder
get

Checks if the path leads to a folder in the filesystem or could lead to one (if it does not exist).

Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ ParentPath

LocalFilesystemPath Joutsen.IO.LocalFilesystemPath.ParentPath
get

Returns the path representing the parent of the current path.

Remarks
The parent of a path is usually the path leading to the folder containing the current element of the filesystem. If the path represents the root of the filesystem this property is null.
Since
0.4.0

Implements Joutsen.IO.FilesystemPath.

◆ Root

LocalFilesystemPath Joutsen.IO.LocalFilesystemPath.Root
get

Returns the root of the path.

Since
0.4.0

Implements Joutsen.IO.FilesystemPath.