This class defines some file utilities. More...
#include <DcFileUtil.h>
Public Member Functions | |
CdcFileUtil () | |
Constructor - empty. | |
virtual | ~CdcFileUtil () |
Destructor - empty. | |
bool | OpenFile (const CdcString &file_name) |
Load File info from file system. | |
CdcHttpTime | GetFileLastModified (bool gmt) |
Returns the file last-modified time. | |
int | GetFileSize () |
Returns the file size in bytes. | |
Static Public Member Functions | |
static CdcString | GetProgramPath () |
Static function to return the path where the application is running. | |
static CdcString | GetWorkPath (const CdcString &path) |
Returns the working path of this program. | |
static t_files_vector | GetAllFilesInDir (const CdcString &dir_path, const CdcString &file_ext) |
This static function return a vector with all files (with specific extension) in a directory. |
This class defines some file utilities.
I need it to be OS Independent. Getting information about the file is a non-static operation. The first query about file info will get the file info from the file system. Then any query will just returns info from the same structure.
In addition I have here: Get a list of files in a directory - static. Get the run-time path - static.
Definition at line 47 of file DcFileUtil.h.
CdcFileUtil::CdcFileUtil | ( | ) | [inline] |
Constructor - empty.
Definition at line 64 of file DcFileUtil.h.
virtual CdcFileUtil::~CdcFileUtil | ( | ) | [inline, virtual] |
Destructor - empty.
Definition at line 69 of file DcFileUtil.h.
t_files_vector CdcFileUtil::GetAllFilesInDir | ( | const CdcString & | dir_path, |
const CdcString & | file_ext | ||
) | [static] |
This static function return a vector with all files (with specific extension) in a directory.
dir_path | The path to the directory to scan. |
file_ext | The extension of the files to get. '*' will return all files. |
Definition at line 76 of file DcFileUtil.cpp.
CdcHttpTime CdcFileUtil::GetFileLastModified | ( | bool | gmt ) |
Returns the file last-modified time.
gmt | True if need time in GMT form. |
Definition at line 36 of file DcFileUtil.cpp.
int CdcFileUtil::GetFileSize | ( | ) |
Returns the file size in bytes.
Definition at line 45 of file DcFileUtil.cpp.
CdcString CdcFileUtil::GetProgramPath | ( | ) | [static] |
Static function to return the path where the application is running.
This function will check for the program path just once!
Definition at line 55 of file DcFileUtil.cpp.
Returns the working path of this program.
If the path supplied as parameter is not an absolute path, it returns the base path + the parameter path. Otherwise it just returns the path without changing it.
path | The path to add the work path to. |
Definition at line 67 of file DcFileUtil.cpp.
bool CdcFileUtil::OpenFile | ( | const CdcString & | file_name ) |
Load File info from file system.
file_name | The file name and path. |
Definition at line 29 of file DcFileUtil.cpp.