A class with static methods for file and directory info and manipulation. More...
#include <File.h>
Static Public Member Functions | |
static size_t | Size (const RStr &pathname) |
Returns the file size of pathname, or 0 if the file does not exist. | |
static bool | Exists (const RStr &pathname) |
Returns true if the file pathname exists. | |
static bool | Delete (const RStr &pathname, bool quiet_fail=true) |
Deletes the file pathname, returning true if it succeeded. More... | |
static void | Copy (const RStr &srcfile, const RStr &destfile, bool overwrite=true) |
Copies the contents of srcfile to destfile. It will overwrite an existing file only if overwrite is true. More... | |
static void | Move (const RStr &srcfile, const RStr &destfile, bool overwrite=true) |
Moves srcfile to destfile by copying the contents and then deleting srcfile. More... | |
static bool | MakeDir (const RStr &dirname, bool return_true_if_exists=true) |
Makes a new directory dirname. More... | |
static RStr | CurrentDir () |
Returns the current working directory. | |
static Data1D< RStr > | DirList (const RStr &path, bool qualified=false) |
Returns a list of entries in the directory path. More... | |
static RStr | Dirname (const RStr &filename) |
Extracts the directory portion of filename, or the current directory if filename has no directory. | |
static RStr | Basename (const RStr &filename) |
Extracts the basename portion of filename, which excludes the directory. | |
static RStr | FullPath (const RStr &path, const RStr &filename) |
Merges path and filename into a path with a divider inserted if needed. | |
static RStr | Extension (const RStr &filename) |
Extracts the filename's extension. | |
static RStr | NoExtension (const RStr &filename) |
Extracts the filename without the extension. | |
Static Public Attributes | |
static const char | divider = '\\' |
The OS-specific divider between directories in a pathname. | |
A class with static methods for file and directory info and manipulation.
|
inlinestatic |
Copies the contents of srcfile to destfile. It will overwrite an existing file only if overwrite is true.
Throws ErrorMsgFile if an error occurs.
|
inlinestatic |
Deletes the file pathname, returning true if it succeeded.
If quiet_fail is false, an exception is thrown upon failure.
Returns a list of entries in the directory path.
If qualified is true, the returned entries are fully qualified pathnames. Throws ErrorMsgFile if the directory cannot be read.
|
inlinestatic |
Makes a new directory dirname.
|
inlinestatic |
Moves srcfile to destfile by copying the contents and then deleting srcfile.
Note: This first attempts an efficient rename, but if that fails it falls back to a copy/delete operation. ErrorMsgFile is thrown if the move fails.