|
MaterialX 1.38.2
|
A generic file path, supporting both syntactic and file system operations. More...
#include <File.h>
Public Types | |
| enum | Type { TypeRelative = 0 , TypeAbsolute = 1 , TypeNetwork = 2 } |
| enum | Format { FormatWindows = 0 , FormatPosix = 1 , FormatNative = FormatPosix } |
Public Member Functions | |
| 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. | |
| FilePath (const char *str) | |
| Construct a path from a C-style string. | |
| operator string () const | |
| Convert a path to a standard string. | |
| void | assign (const string &str) |
| Assign a path from a standard string. | |
| string | asString (Format format=FormatNative) const |
| Return this path as a standard string with the given format. | |
| bool | isEmpty () const |
| Return true if the given path is empty. | |
| bool | isAbsolute () const |
| Return true if the given path is absolute. | |
| const string & | getBaseName () const |
| Return the base name of the given path, with leading directory information removed. | |
| FilePath | getParentPath () const |
| Return the parent directory of the given path, if any. More... | |
| string | getExtension () const |
| Return the file extension of the given path. | |
| void | addExtension (const string &ext) |
| Add a file extension to the given path. | |
| void | removeExtension () |
| Remove the file extension, if any, from the given path. | |
| FilePath | operator/ (const FilePath &rhs) const |
| Concatenate two paths with a directory separator, returning the combined path. | |
| size_t | size () const |
| Return the number of strings in the path. | |
| string | operator[] (size_t index) |
| Return the string at the given index. | |
| const string & | operator[] (size_t index) const |
| Return the const string at the given index. | |
File System Operations | |
| bool | exists () const |
| Return true if the given path exists on the file system. | |
| bool | isDirectory () const |
| Return true if the given path is a directory on the file system. | |
| FilePathVec | getFilesInDirectory (const string &extension) const |
| Return a vector of all files in the given directory with the given extension. | |
| FilePathVec | getSubDirectories () const |
| Return a vector of all directories at or beneath the given path. | |
| void | createDirectory () const |
| Create a directory on the file system at the given path. | |
Static Public Member Functions | |
| static FilePath | getCurrentPath () |
| Return the current working directory of the file system. | |
| static FilePath | getModulePath () |
| Return the directory containing the executable module. | |
A generic file path, supporting both syntactic and file system operations.
|
inline |
Return the parent directory of the given path, if any.
If no parent directory is present, then the empty path is returned.