Table of Contents

Class Paths

Namespace
NanoByte.Common.Storage
Assembly
NanoByte.Common.dll

Helper methods for resolving file system paths.

public static class Paths
Inheritance
object
Paths

Methods

Absolute(string)

Returns the absolute path for the specified path string.

public static string Absolute(string path)

Parameters

path string

Returns

string

Exceptions

IOException

The path contains invalid characters.

Combine(params string[])

Combines an array of strings into a path.

public static string Combine(params string[] paths)

Parameters

paths string[]

Returns

string

Exceptions

IOException

One of the strings in the array contains invalid characters.

FileName(string)

Returns the file name portion of the specified path string.

public static string FileName(string path)

Parameters

path string

Returns

string

Exceptions

IOException

The path contains invalid characters.

IsAbsolute(string)

Indicates whether the specified path string is an absolute path.

public static bool IsAbsolute(string path)

Parameters

path string

Returns

bool

Exceptions

IOException

The path contains invalid characters.

Parent(string)

Returns the absolute path of the parent directory of the specified path string.

public static string Parent(string path)

Parameters

path string

Returns

string

Exceptions

IOException

The path contains invalid characters.

ResolveFiles(IEnumerable<string>, string)

Resolves paths to absolute file paths with wildcard support.

public static IList<FileInfo> ResolveFiles(IEnumerable<string> paths, string defaultPattern = "*")

Parameters

paths IEnumerable<string>

The paths to resolve.

defaultPattern string

The default pattern to use for finding files when a directory is specified.

Returns

IList<FileInfo>

Handles to all matching files that were found

Remarks

paths are first interpreted as files, then as directories. Directories are searched using the defaultPattern. * and ? characters are considered as wildcards.

Exceptions

FileNotFoundException

A file that was explicitly specified in paths (no wildcards) could not be found.