Table of Contents

Class PathHelper

Namespace
Bonsai.IO
Assembly
Bonsai.System.dll

Provides a set of static methods for creating and manipulating directory and file names.

public static class PathHelper
Inheritance
PathHelper
Inherited Members

Methods

AppendFileCount(string)

Appends a file count suffix to a file name without modifying its original extension.

public static string AppendFileCount(string path)

Parameters

path string

The file name on which to append the suffix.

Returns

string

The new file name where path has been modified to end with the number of files starting with the specified file name in the containing folder but without modifying the file extension.

AppendSuffix(string, PathSuffix)

Appends the specified well known suffix type to a file name without modifying the extension.

public static string AppendSuffix(string path, PathSuffix suffixType)

Parameters

path string

The file name on which to append the suffix.

suffixType PathSuffix

The suffix type to append.

Returns

string

The new file name where path has been modified to end with the specified suffixType but without modifying the file extension.

AppendSuffix(string, string)

Appends the specified suffix to a file name without modifying its original extension.

public static string AppendSuffix(string path, string suffix)

Parameters

path string

The file name on which to append the suffix.

suffix string

The suffix to append.

Returns

string

The new file name where path has been modified to end with suffix but without modifying the file extension.

AppendTimestamp(string, DateTimeOffset)

Appends a timestamp suffix to a file name without modifying its original extension.

public static string AppendTimestamp(string path, DateTimeOffset timestamp)

Parameters

path string

The file name on which to append the suffix.

timestamp DateTimeOffset

The timestamp to use for generating the suffix.

Returns

string

The new file name where path has been modified to end with the round-trip representation of the specified timestamp but without modifying the file extension.

EnsureDirectory(string)

Checks that all folders along the specified path exist and attempts to create any missing ones.

public static void EnsureDirectory(string path)

Parameters

path string

The path to check for missing folders.