Provides directory operations using std::filesystem. More...
#include <dir.h>
Public Member Functions | |
| Dir ()=default | |
| Constructs a Dir with an empty path. | |
| Dir (const FilePath &path) | |
| Constructs a Dir for the given path. | |
| Dir (const String &path) | |
| Constructs a Dir from a String path. | |
| Dir (const char *path) | |
| Constructs a Dir from a C string path. | |
| FilePath | path () const |
| Returns the directory path. | |
| bool | exists () const |
| Returns true if the directory exists. | |
| bool | isEmpty () const |
| Returns true if the directory is empty. | |
| List< FilePath > | entryList () const |
| Returns a list of all entries in the directory. | |
| List< FilePath > | entryList (const String &filter) const |
| Returns a filtered list of entries in the directory. | |
| Error | mkdir () const |
| Creates this directory. | |
| Error | mkpath () const |
| Creates this directory and all parent directories. | |
| Error | remove () const |
| Removes this directory (must be empty). | |
| Error | removeRecursively () const |
| Removes this directory and all its contents. | |
Static Public Member Functions | |
| static Dir | current () |
| Returns a Dir for the current working directory. | |
| static Dir | home () |
| Returns a Dir for the user's home directory. | |
| static Dir | temp () |
| Returns a Dir for the system temp directory. | |
| static Error | setCurrent (const FilePath &path) |
| Sets the current working directory. | |
Provides directory operations using std::filesystem.
Dir is a simple utility class (not ObjectBase) that wraps std::filesystem directory operations with the promeki API
Constructs a Dir for the given path.
| path | The directory path. |
Constructs a Dir from a C string path.
| path | The directory path string. |
| bool Dir::exists | ( | ) | const |
Returns true if the directory exists.
| bool Dir::isEmpty | ( | ) | const |
Returns true if the directory is empty.
A non-existent directory is considered empty.
| Error Dir::mkdir | ( | ) | const |
Creates this directory.
The parent directory must already exist.
| Error Dir::mkpath | ( | ) | const |
Creates this directory and all parent directories.
| Error Dir::remove | ( | ) | const |
Removes this directory (must be empty).
| Error Dir::removeRecursively | ( | ) | const |
Removes this directory and all its contents.
Sets the current working directory.
| path | The new working directory. |