Static Public Member Functions

static String ChangeExtension (const String &path, const String &extension)
 
static String Combine (const ArrayPtr< String > &paths)
 
static String Combine (const String &path1, const String &path2)
 
static String Combine (const String &path1, const String &path2, const String &path3)
 
static String Combine (const String &path1, const String &path2, const String &path3, const String &path4)
 
static String GetDirectoryName (const String &path)
 
static String GetExtension (const String &path)
 
static String GetFileName (const String &path)
 
static String GetFileNameWithoutExtension (const String &path)
 
static String GetFullPath (const String &path)
 
static ArrayPtr< char_t > GetInvalidFileNameChars ()
 Returns an array containing characters that are not allowed in the names of files. More...
 
static ArrayPtr< char_t > GetInvalidPathChars ()
 Returns an array containing characters that are not allowed in path names. More...
 
static String GetPathRoot (const String &path)
 
static String GetRandomFileName ()
 Returns a randomly generated file name. More...
 
static String GetTempFileName_ ()
 
static String GetTempFileNameSafe ()
 
static String GetTempPath ()
 Returns the path of the current user's temporary directory. More...
 
static bool HasExtension (const String &path)
 
static bool IsPathRooted (const String &path)
 
static void CheckPath (const String &path, const String &msg=u"path", bool allow_empty=1)
 
static String ToString (const boost::filesystem::path &path)
 
static boost::filesystem::path ToBoost (const String &path)
 
static String NormalizePath (const String &path)
 

Static Public Attributes

static const char_t AltDirectorySeparatorChar
 An alternate character used to separate directory levels in a path. More...
 
static const char_t DirectorySeparatorChar
 A character used to separate directory levels in a path. More...
 
static const char_t PathSeparator
 A separator character used to separate path strings in environment variables. More...
 
static const char_t VolumeSeparatorChar
 A volume separator character. More...
 

Detailed Description

Provides methods for manipulating paths. This is a static type with no instance services. You should never create instances of it by any means.

Member Function Documentation

◆ ChangeExtension()

static String System::IO::Path::ChangeExtension ( const String path,
const String extension 
)
static

Changes the extension in the specified file path.

Parameters
pathA file path
extensionThe extension to replace the one in path with
Returns
path with extension replaced with extension

◆ CheckPath()

static void System::IO::Path::CheckPath ( const String path,
const String msg = u"path",
bool  allow_empty = 1 
)
static

Determines if the specified path is valid by checking if it contains invalid characters. An excetion is thrown if the path contains invalid characters.

Parameters
pathThe path to check
msgThe message to pass to the exception object's constructor
allow_emptySpecifies whether an empty or null string should be considered a correct path (true) or not (false); if this parameter is false and path is empty an ArgumentException is thrown; if this parameter is false and path is null an ArgumentNullException is thrown

◆ Combine() [1/4]

static String System::IO::Path::Combine ( const ArrayPtr< String > &  paths)
static

Combines the specified path segments into a single path inserting directory separator characters between the segments if necessary.

Parameters
pathsAn array containing path segments to combine
Returns
The combined path

◆ Combine() [2/4]

static String System::IO::Path::Combine ( const String path1,
const String path2 
)
static

Combines two specified path segments into a single path inserting directory separator character between the segments if necessary.

Parameters
path1The first path segment
path2The second path segment
Returns
The combined path

◆ Combine() [3/4]

static String System::IO::Path::Combine ( const String path1,
const String path2,
const String path3 
)
static

Combines three specified path segments into a single path inserting directory separator characters between the segments if necessary.

Parameters
path1The first path segment
path2The second path segment
path3The third path segment
Returns
The combined path

◆ Combine() [4/4]

static String System::IO::Path::Combine ( const String path1,
const String path2,
const String path3,
const String path4 
)
static

Combines four specified path segments into a single path inserting directory separator characters between the segments if necessary.

Parameters
path1The first path segment
path2The second path segment
path3The third path segment
path4The fourth path segment
Returns
The combined path

◆ GetDirectoryName()

static String System::IO::Path::GetDirectoryName ( const String path)
static

Returns the name of the directory referenced by the specified path.

Parameters
pathA path to a directory
Returns
The directory's name

◆ GetExtension()

static String System::IO::Path::GetExtension ( const String path)
static

Returns the extension of the file referenced by the specified path.

Parameters
pathA path to a file
Returns
The extension of the file

◆ GetFileName()

static String System::IO::Path::GetFileName ( const String path)
static

Returns the name of the file referenced by the specified path.

Parameters
pathA path to a file
Returns
The file's name

◆ GetFileNameWithoutExtension()

static String System::IO::Path::GetFileNameWithoutExtension ( const String path)
static

Returns the name without extension of the file referenced by the specified path.

Parameters
pathA path to a file
Returns
The file's name without extension

◆ GetFullPath()

static String System::IO::Path::GetFullPath ( const String path)
static

Converts the specified path into absolute path.

Parameters
pathThe path to convert
Returns
The absolute path referencing the same antity (which does not have to exist) as path

◆ GetInvalidFileNameChars()

static ArrayPtr<char_t> System::IO::Path::GetInvalidFileNameChars ( )
static

Returns an array containing characters that are not allowed in the names of files.

◆ GetInvalidPathChars()

static ArrayPtr<char_t> System::IO::Path::GetInvalidPathChars ( )
static

Returns an array containing characters that are not allowed in path names.

◆ GetPathRoot()

static String System::IO::Path::GetPathRoot ( const String path)
static

Returns the root directory of the specified path.

Parameters
pathThe path from which to obtain the root
Returns
The root directory of path

◆ GetRandomFileName()

static String System::IO::Path::GetRandomFileName ( )
static

Returns a randomly generated file name.

◆ GetTempFileName_()

static String System::IO::Path::GetTempFileName_ ( )
static

Creates a new file with a unique name and returns a full path to it.

Returns
A full path to the cretaed file

◆ GetTempFileNameSafe()

static String System::IO::Path::GetTempFileNameSafe ( )
static

Creates a new file with a unique name and returns a full path to it. Is a synonym of GetTempFileName_() method.

Returns
A full path to the cretaed file

◆ GetTempPath()

static String System::IO::Path::GetTempPath ( )
static

Returns the path of the current user's temporary directory.

◆ HasExtension()

static bool System::IO::Path::HasExtension ( const String path)
static

Determines if the specified path references a file with extension.

Parameters
pathA path to check
Returns
True if path references a file with extension, otherwise - false

◆ IsPathRooted()

static bool System::IO::Path::IsPathRooted ( const String path)
static

Determines if the spacified path contains a root.

Parameters
pathA path to check
Returns
True if path contains a root, otherwise - false

◆ NormalizePath()

static String System::IO::Path::NormalizePath ( const String path)
static

Normalizes the specified path.

Parameters
pathA path to normalize
Returns
The normalized path

◆ ToBoost()

static boost::filesystem::path System::IO::Path::ToBoost ( const String path)
static

Returns an instance of boost::filesystem::path class that represents the specified path.

Parameters
pathA path
Returns
a new instance of boost::filesystem::path class that represents path

◆ ToString()

static String System::IO::Path::ToString ( const boost::filesystem::path &  path)
static

Returns a string representation of the specified Boost's path object.

Parameters
pathThe boost::filesystem::path object to convert to string
Returns
A string representation of path

Member Data Documentation

◆ AltDirectorySeparatorChar

const char_t System::IO::Path::AltDirectorySeparatorChar
static

An alternate character used to separate directory levels in a path.

◆ DirectorySeparatorChar

const char_t System::IO::Path::DirectorySeparatorChar
static

A character used to separate directory levels in a path.

◆ PathSeparator

const char_t System::IO::Path::PathSeparator
static

A separator character used to separate path strings in environment variables.

◆ VolumeSeparatorChar

const char_t System::IO::Path::VolumeSeparatorChar
static

A volume separator character.