A simple static class for dealing with files. More...
#include <gfile.h>
Classes | |
class | NoThrow |
An overload discriminator class for File methods. More... | |
Public Types | |
typedef DateTime::EpochTime | time_type |
Static Public Member Functions | |
static bool | remove (const Path &path, const NoThrow &) |
Deletes the file or directory. Returns false on error. More... | |
static void | remove (const Path &path) |
Deletes the file or directory. Throws an exception on error. More... | |
static bool | rename (const Path &from, const Path &to, const NoThrow &) |
Renames the file. Returns false on error. More... | |
static void | rename (const Path &from, const Path &to) |
Renames the file. More... | |
static bool | copy (const Path &from, const Path &to, const NoThrow &) |
Copies a file. Returns false on error. More... | |
static void | copy (const Path &from, const Path &to) |
Copies a file. More... | |
static void | copy (std::istream &from, std::ostream &to, std::streamsize limit=0U, std::string::size_type block=0U) |
Copies a stream with an optional size limit. More... | |
static bool | mkdirs (const Path &dir, const NoThrow &, int=100) |
Creates a directory and all necessary parents. More... | |
static void | mkdirs (const Path &dir, int=100) |
Creates a directory and all necessary parents. More... | |
static bool | mkdir (const Path &dir, const NoThrow &) |
Creates a directory. Returns false on error. More... | |
static void | mkdir (const Path &dir) |
Creates a directory. More... | |
static std::string | sizeString (const Path &file) |
Returns the file's size in string format. More... | |
static bool | exists (const Path &file) |
Returns true if the file (directory, link, device etc.) exists. More... | |
static bool | exists (const Path &file, const NoThrow &) |
Returns true if the file (directory, link, device etc.) exists. More... | |
static time_type | time (const Path &file) |
Returns the file's timestamp. More... | |
static time_type | time (const Path &file, const NoThrow &) |
Returns the file's timestamp. More... | |
static void | chmodx (const Path &file) |
Makes the file executable. More... | |
static bool | chmodx (const Path &file, const NoThrow &) |
Makes the file executable. More... | |
static void | link (const Path &target, const Path &new_link) |
Creates a symlink. More... | |
static bool | link (const Path &target, const Path &new_link, const NoThrow &) |
Creates a symlink. More... | |
static bool | executable (const Path &) |
Returns true if the path is probably executable. More... | |
static void | create (const Path &) |
Creates an empty file. Throws on error. More... | |
Friends | |
class | G::DirectoryIteratorImp |
A simple static class for dealing with files.
|
static |
Copies a file. Returns false on error.
Definition at line 70 of file gfile.cpp.
Referenced by filter_run().
|
static |
Copies a stream with an optional size limit.
Definition at line 101 of file gfile.cpp.
References G::limits::file_buffer.
|
static |
Creates an empty file. Throws on error.
Definition at line 188 of file gfile.cpp.
References G::Path::str().
|
static |
Returns true if the path is probably executable.
Because of portability and implementation difficulties this does not return a definitive result so it should only used for generating warnings on a false return.
Definition at line 50 of file gfile_unix.cpp.
References G::Path::str().
Referenced by GSmtp::FactoryParser::check().
|
static |
Returns true if the file (directory, link, device etc.) exists.
Throws an exception if permission denied or too many symlinks etc.
Definition at line 130 of file gfile.cpp.
Referenced by GSmtp::FactoryParser::check(), GSmtp::StoredFile::fail(), and filter_run().
Creates a symlink.
Definition at line 122 of file gfile_unix.cpp.
References G::limits::path, and G::Path::str().
Creates a directory. Returns false on error.
Definition at line 30 of file gfile_unix.cpp.
References G::Path::str().
|
static |
Creates a directory and all necessary parents.
Returns false on error. Does chmodx() on all created directories.
Definition at line 169 of file gfile.cpp.
References G::Path::dirname(), G_DEBUG, and G::Path::str().
|
static |
Creates a directory and all necessary parents.
Does chmodx() on all created directories.
Definition at line 182 of file gfile.cpp.
References G::Path::str().
Deletes the file or directory. Returns false on error.
Definition at line 29 of file gfile.cpp.
References G_DEBUG, and G::Path::str().
Referenced by GSmtp::StoredFile::destroy(), and filter_run().
|
static |
Deletes the file or directory. Throws an exception on error.
Definition at line 36 of file gfile.cpp.
References G_DEBUG, and G::Path::str().
Renames the file. Returns false on error.
Definition at line 46 of file gfile.cpp.
References G_DEBUG, and G::Path::str().
Referenced by GSmtp::StoredFile::fail(), GSmtp::StoredFile::lock(), and GSmtp::StoredFile::unfail().
|
static |
Returns the file's size in string format.
Returns the empty string on error.
Definition at line 67 of file gfile_unix.cpp.
References G::Path::str().
Referenced by GSmtp::SpamClient::request(), and G::DirectoryIteratorImp::sizeString().
|
static |
Returns the file's timestamp.
Definition at line 78 of file gfile_unix.cpp.
References G::Path::str().
|
static |
Returns the file's timestamp.
Returns zero on error.
Definition at line 86 of file gfile_unix.cpp.
References G::Path::str().
|
friend |