11#ifndef CCGL_UTILS_FILESYSTEM_H
12#define CCGL_UTILS_FILESYSTEM_H
25namespace utils_filesystem {
82string ReplaceSuffix(
string const& full_filename,
string const& new_suffix);
122string ConcatFullName(
string const& fdir,
string const& corename,
string const& suffix = std::string());
159int FindFiles(
const char* lp_path,
const char* expression, vector<string>& vec_files);
int DeleteExistedFile(const string &filepath)
Delete the given file if existed.
string GetPathFromFullName(string const &full_filename)
Get Path From full file path string.
string AppendCoreFileName(string const &full_filename, string const &endstr, char deli='_')
Append a given string to the core filename.
bool DeleteDirectory(const string &dirpath, bool del_subdirs=true)
Delete a directory if exists.
bool FileExists(string const &filename)
Return a flag indicating if the given file exists.
string PrefixCoreFileName(string const &full_filename, string const &prestr, char deli='_')
Add a prefix to the core filename.
string GetCoreFileName(string const &full_filename)
Return the file name from a given file's path.
bool PathExists(string const &path)
Return a flag indicating if the given path (directory or file) exists.
string ConcatFullName(string const &fdir, string const &corename, string const &suffix=std::string())
Concatenate directory, core file name, and suffix.
string GetAppPath()
Get the root path of the current executable file.
bool CleanDirectory(const string &dirpath)
Clean a directory if exists, otherwise create it.
string GetSuffix(string const &full_filename)
Return the suffix of a given file's path without dot, e.g., "tif", "asc".
string GetAbsolutePath(string const &full_filename)
Return the absolute file path from a given file path.
int FindFiles(const char *lp_path, const char *expression, vector< string > &vec_files)
Find files in given paths.
string ReplaceSuffix(string const &full_filename, string const &new_suffix)
Replace the suffix by a given suffix.
bool FilesExist(vector< string > &filenames)
Return a flag indicating if given files exist.
bool MakeDirectory(const string &dirpath)
Make directory if not exists.
bool LoadPlainTextFile(const string &filepath, vector< string > &content_strs)
Load short plain text file as string vector, ignore comments begin with '#' and empty lines.
bool DirectoryExists(const string &dirpath)
Check the given directory path (not regular file!) is exists or not.
Common Cross-platform Geographic Library (CCGL)