utils_filesystem.h File Reference

File system related functions in CCGL. More...

#include "basic.h"
#include <vector>

Go to the source code of this file.

Namespaces

namespace  ccgl
 Common Cross-platform Geographic Library (CCGL)
 
namespace  ccgl::utils_filesystem
 File Input and output related functions.
 

Functions

bool ccgl::utils_filesystem::DirectoryExists (const string &dirpath)
 Check the given directory path (not regular file!) is exists or not.
 
bool ccgl::utils_filesystem::MakeDirectory (const string &dirpath)
 Make directory if not exists.
 
bool ccgl::utils_filesystem::CleanDirectory (const string &dirpath)
 Clean a directory if exists, otherwise create it. More...
 
bool ccgl::utils_filesystem::DeleteDirectory (const string &dirpath, bool del_subdirs=true)
 Delete a directory if exists. More...
 
string ccgl::utils_filesystem::GetAppPath ()
 Get the root path of the current executable file. More...
 
string ccgl::utils_filesystem::GetAbsolutePath (string const &full_filename)
 Return the absolute file path from a given file path. More...
 
string ccgl::utils_filesystem::GetCoreFileName (string const &full_filename)
 Return the file name from a given file's path. More...
 
string ccgl::utils_filesystem::GetSuffix (string const &full_filename)
 Return the suffix of a given file's path without dot, e.g., "tif", "asc". More...
 
string ccgl::utils_filesystem::ReplaceSuffix (string const &full_filename, string const &new_suffix)
 Replace the suffix by a given suffix. More...
 
string ccgl::utils_filesystem::AppendCoreFileName (string const &full_filename, string const &endstr, char deli='_')
 Append a given string to the core filename. More...
 
string ccgl::utils_filesystem::AppendCoreFileName (string const &full_filename, vint endint, char deli='_')
 Append a given integer to the core filename.
 
string ccgl::utils_filesystem::PrefixCoreFileName (string const &full_filename, string const &prestr, char deli='_')
 Add a prefix to the core filename. More...
 
string ccgl::utils_filesystem::PrefixCoreFileName (string const &full_filename, vint preint, char deli='_')
 Add a prefix to the core filename.
 
string ccgl::utils_filesystem::GetPathFromFullName (string const &full_filename)
 Get Path From full file path string. More...
 
string ccgl::utils_filesystem::ConcatFullName (string const &fdir, string const &corename, string const &suffix=std::string())
 Concatenate directory, core file name, and suffix.
 
bool ccgl::utils_filesystem::FileExists (string const &filename)
 Return a flag indicating if the given file exists. More...
 
bool ccgl::utils_filesystem::FilesExist (vector< string > &filenames)
 Return a flag indicating if given files exist. More...
 
bool ccgl::utils_filesystem::PathExists (string const &path)
 Return a flag indicating if the given path (directory or file) exists. More...
 
int ccgl::utils_filesystem::DeleteExistedFile (const string &filepath)
 Delete the given file if existed. More...
 
int ccgl::utils_filesystem::FindFiles (const char *lp_path, const char *expression, vector< string > &vec_files)
 Find files in given paths. More...
 
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. More...
 

Detailed Description

File system related functions in CCGL.

Remarks
  • 1. 2018-05-02 - lj - Make part of CCGL.
Author
Liangjun Zhu, zlj(at)lreis.ac.cn)
Version
1.0