Rudiments
|
#include <directory.h>
Inherits object.
Public Member Functions | |
directory () | |
~directory () | |
bool | open (const char *path) |
bool | close () |
bool | skip () |
char * | read () |
void | rewind () |
uint64_t | getChildCount () |
char * | getChildName (uint64_t index) |
int64_t | getMaxFileNameLength () |
int64_t | getMaxPathLength () |
bool | getCanExceedMaxFileNameLength () |
Public Member Functions inherited from object | |
virtual | ~object () |
Static Public Member Functions | |
static bool | create (const char *path, mode_t perms) |
static bool | createTemporaryDirectory (char *templatedirname, mode_t perms) |
static bool | remove (const char *path) |
static bool | removeTree (const char *path) |
static char * | getCurrentWorkingDirectory () |
static bool | changeDirectory (const char *path) |
static bool | changeRoot (const char *path) |
static int64_t | getMaxFileNameLength (const char *pathname) |
static int64_t | getMaxPathLength (const char *pathname) |
static bool | getCanExceedMaxFileNameLength (const char *pathname) |
The directory class provides methods for opening/closing a directory and traversing it's files and subdirectories.
directory::directory | ( | ) |
Creates an instance of the directory class.
directory::~directory | ( | ) |
Deletes this instance of the directory class.
Sets the current working directory to "path".
bool directory::close | ( | ) |
Closes the currently open directory.
Creates a new directory "path" with permissions "perms".
Creates a (presumably) temporary directory using "templatedirname" as a template. The permissions of the directory will be set to "perms".
The last 6 characters of "templatedirname" must be XXXXXX and "templatedirname" will be modified to contain the name of the directory that was actually created.
Returns true on success and false on failure.
bool directory::getCanExceedMaxFileNameLength | ( | ) |
Returns true if an attempt to access a file in directory "pathname" longer than the character length returned by maxFileNameLength() will succeed and false if it will fail.
Returns true if an attempt to access a file in directory "pathname" longer than the character length returned by maxFileNameLength() will succeed and false if it will fail.
uint64_t directory::getChildCount | ( | ) |
Returns the number of files/subdirectories inside the open directory.
char * directory::getChildName | ( | uint64_t | index | ) |
Returns the name of the file/subdirectory at "index".
This methods allocates a buffer internally and returns it. The calling program must deallocate the buffer.
Returns the current working directory.
This methods allocates a buffer internally and returns it. The calling program must deallocate the buffer.
int64_t directory::getMaxFileNameLength | ( | ) |
Returns the character length of the longest file name that can be created in the currently open directory .
Returns the character length of the longest file name that can be created in directory "pathname".
int64_t directory::getMaxPathLength | ( | ) |
Returns the character length of the longest relative path name that can be created in the currently open directory .
Returns the character length of the longest relative path name that can be created under the directory "pathname".
char * directory::read | ( | ) |
Returns the name of the current file inside the open directory and moves on to the next one. If there was no file at the current position then this method returns NULL.
Removes the directory "path", if it is empty.
Removes the directory "path", and its contents.
void directory::rewind | ( | ) |
Resets the current file/subdirectory inside the open directory to the first one.
bool directory::skip | ( | ) |
Moves from the current file inside the open directory to the next one. Returns true if there was a next file and false otherwise.