File Input and output related functions 更多...
函数 | |
bool | DirectoryExists (const string &dirpath) |
Check the given directory path (not regular file!) is exists or not. | |
bool | MakeDirectory (const string &dirpath) |
Make directory if not exists | |
bool | CleanDirectory (const string &dirpath) |
Clean a directory if exists, otherwise create it. | |
bool | DeleteDirectory (const string &dirpath, bool del_subdirs=true) |
Delete a directory if exists. 更多... | |
string | GetAppPath () |
Get the root path of the current executable file 更多... | |
string | GetAbsolutePath (string const &full_filename) |
Return the absolute file path from a given file path 更多... | |
string | GetCoreFileName (string const &full_filename) |
Return the file name from a given file's path 更多... | |
string | GetSuffix (string const &full_filename) |
Return the suffix of a given file's path without dot, e.g., "tif", "asc" 更多... | |
string | ReplaceSuffix (string const &full_filename, string const &new_suffix) |
Replace the suffix by a given suffix 更多... | |
string | AppendCoreFileName (string const &full_filename, string const &endstr, char deli='_') |
Append a given string to the core filename 更多... | |
string | AppendCoreFileName (string const &full_filename, vint endint, char deli='_') |
Append a given integer to the core filename | |
string | PrefixCoreFileName (string const &full_filename, string const &prestr, char deli='_') |
Add a prefix to the core filename 更多... | |
string | PrefixCoreFileName (string const &full_filename, vint preint, char deli='_') |
Add a prefix to the core filename | |
string | GetPathFromFullName (string const &full_filename) |
Get Path From full file path string 更多... | |
string | ConcatFullName (string const &fdir, string const &corename, string const &suffix=std::string()) |
Concatenate directory, core file name, and suffix | |
bool | FileExists (string const &filename) |
Return a flag indicating if the given file exists 更多... | |
bool | FilesExist (vector< string > &filenames) |
Return a flag indicating if given files exist 更多... | |
bool | PathExists (string const &path) |
Return a flag indicating if the given path (directory or file) exists 更多... | |
int | DeleteExistedFile (const string &filepath) |
Delete the given file if existed. 更多... | |
int | FindFiles (const char *lp_path, const char *expression, vector< string > &vec_files) |
Find files in given paths 更多... | |
bool | LoadPlainTextFile (const string &filepath, vector< string > &content_strs) |
Load short plain text file as string vector, ignore comments begin with '#' and empty lines 更多... | |
File Input and output related functions
string ccgl::utils_filesystem::AppendCoreFileName | ( | string const & | full_filename, |
string const & | endstr, | ||
char | deli = '_' |
||
) |
Append a given string to the core filename
[in] | full_filename | Full file path |
[in] | endstr | End string |
[in] | deli | (Optional) Delimiter |
bool ccgl::utils_filesystem::DeleteDirectory | ( | const string & | dirpath, |
bool | del_subdirs = true |
||
) |
Delete a directory if exists.
Reference:
int ccgl::utils_filesystem::DeleteExistedFile | ( | const string & | filepath | ) |
Delete the given file if existed.
[in] | filepath | string File path, full path or relative path |
bool ccgl::utils_filesystem::FileExists | ( | string const & | filename | ) |
Return a flag indicating if the given file exists
[in] | filename | String path of file |
bool ccgl::utils_filesystem::FilesExist | ( | vector< string > & | filenames | ) |
Return a flag indicating if given files exist
[in] | filenames | Vector of full file paths |
int ccgl::utils_filesystem::FindFiles | ( | const char * | lp_path, |
const char * | expression, | ||
vector< string > & | vec_files | ||
) |
Find files in given paths
[in] | lp_path | Directory path |
[in] | expression | Wildcard characters, e.g., "*.*" means any filename with any suffix |
[out] | vec_files | Vector of full file paths |
string ccgl::utils_filesystem::GetAbsolutePath | ( | string const & | full_filename | ) |
Return the absolute file path from a given file path
[in] | full_filename | Full file path |
string ccgl::utils_filesystem::GetAppPath | ( | ) |
Get the root path of the current executable file
string ccgl::utils_filesystem::GetCoreFileName | ( | string const & | full_filename | ) |
Return the file name from a given file's path
[in] | full_filename | Full file path |
string ccgl::utils_filesystem::GetPathFromFullName | ( | string const & | full_filename | ) |
string ccgl::utils_filesystem::GetSuffix | ( | string const & | full_filename | ) |
Return the suffix of a given file's path without dot, e.g., "tif", "asc"
[in] | full_filename | Full file path |
bool ccgl::utils_filesystem::LoadPlainTextFile | ( | const string & | filepath, |
vector< string > & | content_strs | ||
) |
Load short plain text file as string vector, ignore comments begin with '#' and empty lines
[in] | filepath | Plain text file path |
[out] | content_strs | Each line without CRLF or LF stored in vector |
bool ccgl::utils_filesystem::PathExists | ( | string const & | path | ) |
Return a flag indicating if the given path (directory or file) exists
[in] | path | String path |
string ccgl::utils_filesystem::PrefixCoreFileName | ( | string const & | full_filename, |
string const & | prestr, | ||
char | deli = '_' |
||
) |
Add a prefix to the core filename
[in] | full_filename | Full file path |
[in] | prestr | Start string |
[in] | deli | (Optional) Delimiter |
string ccgl::utils_filesystem::ReplaceSuffix | ( | string const & | full_filename, |
string const & | new_suffix | ||
) |
Replace the suffix by a given suffix
[in] | full_filename | Full file path |
[in] | new_suffix | New suffix without dot, e.g., "tif", "asc" |