VideoTools
|
An encapsulation of a file system directory that allows for iterating through the set of contained files. More...
#include <gdirectory.h>
Public Member Functions | |
Directory () | |
Default constructor for the current directory. | |
Directory (const char *path) | |
Constructor. | |
Directory (const Path &path) | |
Constructor. | |
Directory (const std::string &path) | |
Constructor. | |
~Directory () | |
Destructor. | |
bool | valid (bool for_creating_files=false) const |
Returns true if the object represents a valid directory. More... | |
bool | writeable (std::string probe_filename=tmp()) const |
Tries to create and then delete an empty test file in the directory. More... | |
Path | path () const |
Returns the directory's path. | |
Directory (const Directory &other) | |
Copy constructor. | |
Directory & | operator= (const Directory &) |
Assignment operator. | |
Static Public Member Functions | |
static std::string | tmp () |
A convenience function for constructing a filename for writeable(). More... | |
An encapsulation of a file system directory that allows for iterating through the set of contained files.
Definition at line 45 of file gdirectory.h.
|
static |
A convenience function for constructing a filename for writeable().
This is factored-out to this public interface so that client code can minimise the time spent with a privileged effective userid.
Definition at line 99 of file gdirectory_unix.cpp.
bool G::Directory::valid | ( | bool | for_creating_files = false | ) | const |
Returns true if the object represents a valid directory.
Does additional checks if the 'for-creating-files' parameter is true. But note that the answer is not definitive – file creation may fail, even if valid() returns true. For a more accurate test use writeable().
Definition at line 69 of file gdirectory_unix.cpp.
bool G::Directory::writeable | ( | std::string | probe_filename = tmp() | ) | const |
Tries to create and then delete an empty test file in the directory.
Returns true on success. Precondition: valid()
Definition at line 106 of file gdirectory_unix.cpp.