Table of Contents

Class PathStrings

Namespace
TruePath
Assembly
TruePath.dll

Helper methods to manipulate paths as strings.

public static class PathStrings
Inheritance
PathStrings
Inherited Members

Methods

Normalize(string)

Will convert a path string to a normalized path, using path separator specific for the current system.

The normalization includes:

  • converting all the AltDirectorySeparatorChar to DirectorySeparatorChar (e.g. / to \ on Windows),
  • collapsing any repeated separators in the input to only one separator (e.g. // to just / on Unix),
  • resolving any sequence of current and parent directory marks (subsequently, . and ..) if possible (meaning they will not be replaced if they are in the root position: paths such as . or ../.. will not be affected by the normalization, while e.g. foo/../. will be resolved to just foo).

Note that this operation will never perform any file IO, and is purely string manipulation.

public static string Normalize(string path)

Parameters

path string

Returns

string