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:

<ul><li>
        converting all the <xref href="System.IO.Path.AltDirectorySeparatorChar" data-throw-if-not-resolved="false"></xref> to
        <xref href="System.IO.Path.DirectorySeparatorChar" data-throw-if-not-resolved="false"></xref> (e.g. <code>/</code> to <code>\</code> on Windows),
    </li><li>
        collapsing any repeated separators in the input to only one separator (e.g. <code>//</code> to just
        <code>/</code> on Unix),
    </li><li>
        resolving any sequence of current and parent directory marks (subsequently, <code>.</code> and <code>..</code>)
        if possible (meaning they will not be replaced if they are in the root position: paths such as
        <code>.</code> or <code>../..</code> will not be affected by the normalization, while e.g. <code>foo/../.</code> will
        be resolved to just <code>foo</code>).
    </li></ul>

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