HDK
|
#include <File.h>
Public Types | |
enum | Type { TypeRelative = 0, TypeAbsolute = 1, TypeNetwork = 2 } |
enum | Format { FormatWindows = 0, FormatPosix = 1, FormatNative = FormatPosix } |
Public Member Functions | |
FilePath () | |
~FilePath () | |
bool | operator== (const FilePath &rhs) const |
bool | operator!= (const FilePath &rhs) const |
Syntactic Operations | |
FilePath (const string &str) | |
Construct a path from a standard string. More... | |
FilePath (const char *str) | |
Construct a path from a C-style string. More... | |
operator string () const | |
Convert a path to a standard string. More... | |
void | assign (const string &str) |
Assign a path from a standard string. More... | |
string | asString (Format format=FormatNative) const |
Return this path as a standard string with the given format. More... | |
bool | isEmpty () const |
Return true if the given path is empty. More... | |
bool | isAbsolute () const |
Return true if the given path is absolute. More... | |
const string & | getBaseName () const |
FilePath | getParentPath () const |
string | getExtension () const |
Return the file extension of the given path. More... | |
void | addExtension (const string &ext) |
Add a file extension to the given path. More... | |
void | removeExtension () |
Remove the file extension, if any, from the given path. More... | |
FilePath | operator/ (const FilePath &rhs) const |
size_t | size () const |
Return the number of strings in the path. More... | |
string | operator[] (size_t index) |
Return the string at the given index. More... | |
const string & | operator[] (size_t index) const |
Return the const string at the given index. More... | |
FilePath | getNormalized () const |
File System Operations | |
bool | exists () const |
Return true if the given path exists on the file system. More... | |
bool | isDirectory () const |
Return true if the given path is a directory on the file system. More... | |
FilePathVec | getFilesInDirectory (const string &extension) const |
Return a vector of all files in the given directory with the given extension. More... | |
FilePathVec | getSubDirectories () const |
Return a vector of all directories at or beneath the given path. More... | |
void | createDirectory () const |
Create a directory on the file system at the given path. More... | |
bool | setCurrentPath () |
Set the current working directory of the file system. More... | |
Static Public Member Functions | |
static FilePath | getCurrentPath () |
Return the current working directory of the file system. More... | |
static FilePath | getModulePath () |
Return the directory containing the executable module. More... | |
A generic file path, supporting both syntactic and file system operations.
enum FilePath::Format |
enum FilePath::Type |
|
inline |
|
inline |
string FilePath::asString | ( | Format | format = FormatNative | ) | const |
Return this path as a standard string with the given format.
void FilePath::createDirectory | ( | ) | const |
Create a directory on the file system at the given path.
bool FilePath::exists | ( | ) | const |
Return true if the given path exists on the file system.
|
inline |
|
static |
Return the current working directory of the file system.
|
inline |
FilePathVec FilePath::getFilesInDirectory | ( | const string & | extension | ) | const |
Return a vector of all files in the given directory with the given extension.
|
static |
Return the directory containing the executable module.
FilePath FilePath::getNormalized | ( | ) | const |
Return a normalized version of the given path, collapsing current path and parent path references so that 'a/./b' and 'c/../d/../a/b' become 'a/b'.
|
inline |
FilePathVec FilePath::getSubDirectories | ( | ) | const |
Return a vector of all directories at or beneath the given path.
|
inline |
bool FilePath::isDirectory | ( | ) | const |
Return true if the given path is a directory on the file system.
|
inline |
|
inline |
|
inline |
Concatenate two paths with a directory separator, returning the combined path.
|
inline |
|
inline |
|
inline |
|
inline |
bool FilePath::setCurrentPath | ( | ) |
Set the current working directory of the file system.
|
inline |