FileSurfer 2.1.2
Cross-platform file manager with support for Git and SFTP
Loading...
Searching...
No Matches
FileSurfer.Core.Models.LocalPathTools Class Reference

Provides local file-system path operations using platform-specific separator and comparison rules. More...

Inheritance diagram for FileSurfer.Core.Models.LocalPathTools:
Collaboration diagram for FileSurfer.Core.Models.LocalPathTools:

Static Public Member Functions

static string NormalizePath (string path)
 Normalizes a local path by collapsing repeated separators and trimming trailing separators while preserving root paths.
static string Combine (string pathBase, string pathSuffix)
 Combines a base path and suffix into a single local path.
static string GetParentDir (string path)
 Gets the parent directory for the provided path.
static string GetFileName (string path)
 Gets the file or directory name segment from the provided path.
static string GetExtension (string path)
 Gets the file extension (including leading dot) from the provided path.
static bool PathsAreEqual (string? pathA, string? pathB)
 Determines whether two paths are equal after normalization.
static bool PathsAreEqualNormalized (string? pathA, string? pathB)
 Determines whether two already-normalized paths are equal.
static bool NamesAreEqual (string? nameA, string? nameB)
 Determines whether two file or directory names are equal under local rules.
static IEnumerable< string > EnumerateExtensions (string path)
 Enumerates all extension segments in a file name from left to right.

Static Public Attributes

static readonly LocalPathTools Instance = new()
 Gets the singleton instance of LocalPathTools.

Properties

static char DirSeparator [get]
 Gets the primary directory separator for the current platform.
static char OtherSeparator [get]
 Gets the alternate directory separator for the current platform.
static StringComparison Comparison [get]
 Gets the string comparison mode used for path and name equality.

Detailed Description

Provides local file-system path operations using platform-specific separator and comparison rules.

Member Function Documentation

◆ Combine()

string FileSurfer.Core.Models.LocalPathTools.Combine ( string pathBase,
string pathSuffix )
inlinestatic

Combines a base path and suffix into a single local path.

Parameters
pathBaseBase path.
pathSuffixPath suffix to append.
Returns
Combined path with one separator between segments.

Implements FileSurfer.Core.Models.IPathTools.

◆ EnumerateExtensions()

IEnumerable< string > FileSurfer.Core.Models.LocalPathTools.EnumerateExtensions ( string path)
inlinestatic

Enumerates all extension segments in a file name from left to right.

Parameters
pathPath whose file name extensions should be enumerated.
Returns
Sequence of extension parts without the leading dot.

◆ GetExtension()

string FileSurfer.Core.Models.LocalPathTools.GetExtension ( string path)
inlinestatic

Gets the file extension (including leading dot) from the provided path.

Parameters
pathPath to inspect.
Returns
File extension when present; otherwise an empty string.

Implements FileSurfer.Core.Models.IPathTools.

◆ GetFileName()

string FileSurfer.Core.Models.LocalPathTools.GetFileName ( string path)
inlinestatic

Gets the file or directory name segment from the provided path.

Parameters
pathPath to inspect.
Returns
Final segment name.

Implements FileSurfer.Core.Models.IPathTools.

◆ GetParentDir()

string FileSurfer.Core.Models.LocalPathTools.GetParentDir ( string path)
inlinestatic

Gets the parent directory for the provided path.

Parameters
pathPath to inspect.
Returns
Parent directory path, or an empty string when no parent exists.

Implements FileSurfer.Core.Models.IPathTools.

◆ NamesAreEqual()

bool FileSurfer.Core.Models.LocalPathTools.NamesAreEqual ( string? nameA,
string? nameB )
inlinestatic

Determines whether two file or directory names are equal under local rules.

Parameters
nameAFirst name.
nameBSecond name.
Returns
true when both names are non-null and equal; otherwise false.

Implements FileSurfer.Core.Models.IPathTools.

◆ NormalizePath()

string FileSurfer.Core.Models.LocalPathTools.NormalizePath ( string path)
inlinestatic

Normalizes a local path by collapsing repeated separators and trimming trailing separators while preserving root paths.

Parameters
pathPath to normalize.
Returns
Normalized path.

Implements FileSurfer.Core.Models.IPathTools.

◆ PathsAreEqual()

bool FileSurfer.Core.Models.LocalPathTools.PathsAreEqual ( string? pathA,
string? pathB )
inlinestatic

Determines whether two paths are equal after normalization.

Parameters
pathAFirst path.
pathBSecond path.
Returns
true when both paths are non-null and equal under local rules; otherwise false.

Implements FileSurfer.Core.Models.IPathTools.

◆ PathsAreEqualNormalized()

bool FileSurfer.Core.Models.LocalPathTools.PathsAreEqualNormalized ( string? pathA,
string? pathB )
inlinestatic

Determines whether two already-normalized paths are equal.

Parameters
pathAFirst normalized path.
pathBSecond normalized path.
Returns
true when both paths are non-null and equal under local rules; otherwise false.
Here is the caller graph for this function:

Member Data Documentation

◆ Instance

readonly LocalPathTools FileSurfer.Core.Models.LocalPathTools.Instance = new()
static

Gets the singleton instance of LocalPathTools.

Property Documentation

◆ Comparison

StringComparison FileSurfer.Core.Models.LocalPathTools.Comparison
staticget
Initial value:
=
OperatingSystem.IsWindows() ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal

Gets the string comparison mode used for path and name equality.

◆ DirSeparator

char FileSurfer.Core.Models.LocalPathTools.DirSeparator
staticget

Gets the primary directory separator for the current platform.

Implements FileSurfer.Core.Models.IPathTools.

◆ OtherSeparator

char FileSurfer.Core.Models.LocalPathTools.OtherSeparator
staticget
Initial value:
=
OperatingSystem.IsWindows() ? Path.AltDirectorySeparatorChar : Path.DirectorySeparatorChar

Gets the alternate directory separator for the current platform.


The documentation for this class was generated from the following file:
  • /home/janecea/Documents/CODE/PROJECTS/FileSurfer/src/FileSurfer.Core/Models/LocalPathTools.cs