|
iash
v0.5
Library to provide a bash-like shell in an application
|
Represents a directory on the filesystem. More...
#include <Directory.h>
Public Member Functions | |
| Directory () | |
| Creates a Directory instance pointed at the application's current working directory. More... | |
| Directory (const std::string &dir) | |
Creates a Directory instance pointed at the directory dir. More... | |
| bool | isValid () const |
| Checks if the Directory object points to an existing directory. More... | |
| const std::string & | getAbsPath () const |
| Gets the absolute path to this Directory from the root of the filesystem. More... | |
| bool | changeDirRel (const std::string &relPath) |
Changes this Directory instance to point at the directory with path relPath relative to the directory currently pointed to by this Directory. More... | |
| bool | changeDirAbs (const std::string &absPath) |
Changes this Directory instance to point at the directory with the absolute path absPath. More... | |
| std::string | resolvePath (const std::string &relpath) const |
| Converts a path relative to the current Directory to an absolute path. More... | |
| int | mkSubdir (const std::string &dirName) const |
| Creates a directory inside of the current Directory instance. More... | |
| bool | dirExists (const std::string &dirName) const |
| Checks if the given dirname represents an existing directory inside of the current Directory. More... | |
| bool | fileExists (const std::string &filename) const |
| Checks if the given filename represents an existing file inside of the current Directory. More... | |
Static Public Member Functions | |
| static int | mkdir (const char *pathname) |
Creates a directory with the absolute path pathname. More... | |
| static bool | isDir (const char *pathname) |
Checks if pathname refers to an existing directory. More... | |
| static bool | isFile (const char *pathname) |
Checks if pathname refers to an existing file. More... | |
| static std::string | toIash (const std::string &pathname) |
Converts pathname from system path representation to iash path representation. More... | |
| static std::string | toPlatform (const std::string &pathname) |
Converts pathname from iash path representation to the platform's path representation. More... | |
| static Directory | getHomeDir () |
| Gets the user's home directory as a Directory instance. More... | |
| static Directory | getConfigDir () |
| Gets the user's root application configuration directory ad a Directory instance. More... | |
| static Directory | getWorkingDir () |
| Gets the working directory for this process. More... | |
Represents a directory on the filesystem.
Intended to help with managing filesystem resources in a cross-platform manner.
On Windows platforms, Directory will convert all directory separators to forward slashes (/) from backslashes (\), and expects all arguments to use forward slashes. Since fstream will accept either, there is usually no need to change this.
| Directory::Directory | ( | ) |
| Directory::Directory | ( | const std::string & | dir | ) |
| bool Directory::changeDirAbs | ( | const std::string & | absPath | ) |
Changes this Directory instance to point at the directory with the absolute path absPath.
| bool Directory::changeDirRel | ( | const std::string & | relPath | ) |
| bool Directory::dirExists | ( | const std::string & | dirName | ) | const |
Checks if the given dirname represents an existing directory inside of the current Directory.
| dirName | the name of the directory to check for existence |
| bool Directory::fileExists | ( | const std::string & | filename | ) | const |
Checks if the given filename represents an existing file inside of the current Directory.
| filename | the name of the file to check for existence |
| const string & Directory::getAbsPath | ( | ) | const |
Gets the absolute path to this Directory from the root of the filesystem.
|
static |
Gets the user's root application configuration directory ad a Directory instance.
This does not refer to the application's specific configuration directory.
|
static |
|
static |
Gets the working directory for this process.
Note that this is not the same as the iash working directory; iash stores that internally as a Directory instance.
|
static |
Checks if pathname refers to an existing directory.
| pathname | the path of the directory to check for existence |
|
static |
Checks if pathname refers to an existing file.
| pathname | the path of the file to check for existence |
| bool Directory::isValid | ( | ) | const |
|
static |
Creates a directory with the absolute path pathname.
| pathname | the absolute path of the new directory |
| int Directory::mkSubdir | ( | const std::string & | dirName | ) | const |
Creates a directory inside of the current Directory instance.
| dirName | the name for the new directory |
| string Directory::resolvePath | ( | const std::string & | relpath | ) | const |
|
static |
Converts pathname from system path representation to iash path representation.
On Unix/Linux/macOS, this does nothing.
| pathname | the path to convert to iash representation |
|
static |
Converts pathname from iash path representation to the platform's path representation.
On Unix/Linux/macOS, this does nothing.
| pathname | the path to convert to platform representation |