Represents a directory (folder) in a file system.
Definition at line 42 of file directory.hpp.
#include <directory.hpp>
Public Type Index: | |
enum class | SpecialFolder { Root , Current , Home , HomeConfig , Module , Temp , VarTemp } |
Public Static Field Index: | |
static AString | evaluatedTempDir |
static AString | evaluatedVarTempDir |
Public Static Method Index: | |
static ALIB_API SystemErrors | Create (const CString &path) |
static ALIB_API bool | CurrentDirectory (AString &target) |
static ALIB_API bool | Exists (const CString &path) |
static bool | Exists (const StringNZT &path) |
Public Field Index: | |
AString | Path |
Public Method Index: | |
Directory () | |
Directory (const String &path) | |
Directory (SpecialFolder special) | |
ALIB_API bool | Change (const CString &path) |
ALIB_API bool | Change (const StringNZT &path) |
ALIB_API void | Change (SpecialFolder special) |
|
strong |
Denotes upper and lower case character conversions
Enumerator | |
---|---|
Root | The root directory . |
Current | The current directory of the process. |
Home | The user's home directory |
HomeConfig | The user's configuration directory. This is evaluated as follows:
|
Module | The directory of the executable of the process. |
Temp | A directory to be used for creation of temporary files.
If the directory does not exist, then (on all OS), a new directory named
To overrule this behavior, public static variable evaluatedTempDir may be set arbitrarily prior to using this enum value. |
VarTemp | A directory to be used for creation of temporary files that survives reboots of the host machine.
If the directory does not exist, then (on all OS), a new directory named
To overrule this behavior, public static variable evaluatedVarTempDir may be set arbitrarily prior to using this enum value. |
Definition at line 51 of file directory.hpp.
|
static |
Singleton containing the path for the use of enum value SpecialFolder::Temp. This is evaluated once with the first use of SpecialFolder::Temp. To change the default behavior of evaluation, this variable may be filled with a proper path prior to using enum SpecialFolder::Temp.
Definition at line 126 of file directory.hpp.
|
static |
Singleton containing the path for the use of enum value SpecialFolder::VarTemp. This is evaluated once with the first use of SpecialFolder::VarTemp. To change the default behavior of evaluation, this variable may be filled with a proper path prior to using enum SpecialFolder::VarTemp.
Definition at line 135 of file directory.hpp.
AString Path |
The path of the directory represented by this instance
Definition at line 138 of file directory.hpp.
|
inline |
Constructs an object representing no directory. Field Path remains empty.
Definition at line 148 of file directory.hpp.
|
inline |
Constructs an object representing one of the known special directories.
special | The special directory to initialize this instance to. |
Definition at line 155 of file directory.hpp.
Constructs an object representing the given path.
path | The initial path. If this is a relative path, it relates to the processes current directory. |
Definition at line 165 of file directory.hpp.
bool Change | ( | const CString & | path | ) |
Changes the directory. If the given path is relative (e.g. a name of a sub directory or ".."), such path is added to the current Path. Otherwise, field Path is replaced. If the resulting destination directory is not valid, false
is returned and the field Path stays intact.
path | The relative or absolute path to change to. |
true
if the change was successful, false
otherwise. Definition at line 251 of file directory.cpp.
bool Change | ( | const StringNZT & | path | ) |
Overloaded version of Change(const CString&) accepting a non-zero-terminated string.
path | The relative or absolute path to change to. |
true
if the change was successful, false
otherwise. Definition at line 276 of file directory.cpp.
void Change | ( | SpecialFolder | special | ) |
Changes the directory to one of the known special directories.
special | The special directory to change this instance to. |
Definition at line 88 of file directory.cpp.
|
static |
Creates the directory of the given (absolute or relative) path.
path | Zero-terminated string defining the path to test. |
Definition at line 364 of file directory.cpp.
|
static |
Returns the actual directory in the file system associated with the current process.
target | The target AString to store the directory. Will be cleared in any case |
true
on success, false
on failure. Definition at line 314 of file directory.cpp.
|
static |
Tests if the given (absolute or relative) path represents a directory in the file system.
path | Zero-terminated string defining the path to test. |
true
if a directory was found. Definition at line 334 of file directory.cpp.
|
inlinestatic |
Overloaded version of Change(const CString&) accepting a non-zero-terminated string.
path | The relative or absolute path to change to. |
true
if the change was successful, false
otherwise. Definition at line 225 of file directory.hpp.