C# Class PathLib.Utils.PathUtils

General utilities and separator-agnostic replacements for System.IO.Path methods.
显示文件 Open project: nemec/pathlib

Public Methods

Method Description
ChangeExtension ( string path, string extension, string separator ) : string

Changes the extension of a file path.

GetDirectoryName ( string path, string separator ) : string

Returns the directory path of a file path.

GetExtension ( string path, string separator ) : string

Returns the extension of the given path.

GetFileName ( string path, string separator ) : string

Returns the name and extension parts of the given path.

GetFileNameWithoutExtension ( string path, string separator ) : string

Returns the name and of the given path, minus the extension.

GetPathRoot ( string path, string separator ) : string

Returns the root portion of the given path.

IsPathRooted ( string path, string separator ) : bool

Tests if the given path contains a root.

Private Methods

Method Description
Combine ( IEnumerable paths, string separator ) : IPurePath
Combine ( string path1, string path2, string separator ) : string
Glob ( string pattern, string haystack, bool fullMatch = false, bool caseInsensitive = false ) : bool
TrySafeCombine ( IPurePath @base, IPurePath toJoin, string separator, string &combined ) : bool

Removes all parent directory components. Disallows combining with absolute paths.

findExtension ( string path, string separator ) : int

Method Details

ChangeExtension() public static method

Changes the extension of a file path.
public static ChangeExtension ( string path, string extension, string separator ) : string
path string
extension string
separator string
return string

GetDirectoryName() public static method

Returns the directory path of a file path.
public static GetDirectoryName ( string path, string separator ) : string
path string
separator string
return string

GetExtension() public static method

Returns the extension of the given path.
public static GetExtension ( string path, string separator ) : string
path string
separator string
return string

GetFileName() public static method

Returns the name and extension parts of the given path.
public static GetFileName ( string path, string separator ) : string
path string
separator string
return string

GetFileNameWithoutExtension() public static method

Returns the name and of the given path, minus the extension.
public static GetFileNameWithoutExtension ( string path, string separator ) : string
path string
separator string
return string

GetPathRoot() public static method

Returns the root portion of the given path.
public static GetPathRoot ( string path, string separator ) : string
path string
separator string
return string

IsPathRooted() public static method

Tests if the given path contains a root.
public static IsPathRooted ( string path, string separator ) : bool
path string
separator string
return bool