Fcitx
|
Utility class to open, locate, list files based on XDG standard. More...
#include <fcitx-utils/standardpath.h>
Public Types | |
enum | Type { Type::Config, Type::PkgConfig, Type::Data, Type::Cache, Type::Runtime, Type::Addon, Type::PkgData } |
Enum for location type. More... | |
Public Member Functions | |
StandardPath (bool skipFcitxPath, bool skipUserPath) | |
StandardPath (bool skipFcitxPath=false) | |
void | scanDirectories (Type type, const std::function< bool(const std::string &path, bool user)> &scanner) const |
Scan the directories of given type. More... | |
void | scanDirectories (const std::string &userDir, const std::vector< std::string > &directories, const std::function< bool(const std::string &path, bool user)> &scanner) const |
Scan the given directories. More... | |
void | scanFiles (Type type, const std::string &path, const std::function< bool(const std::string &path, const std::string &dir, bool user)> &scanner) const |
Scan files scan file under [directory]/[path]. More... | |
std::string | userDirectory (Type type) const |
Get user writable directory for given type. | |
std::vector< std::string > | directories (Type type) const |
Get all directories in the order of priority. | |
std::string | locate (Type type, const std::string &path) const |
Check if a file exists. | |
std::vector< std::string > | locateAll (Type type, const std::string &path) const |
list all matched files. | |
StandardPathFile | open (Type type, const std::string &path, int flags) const |
Open the first matched and succeeded file. More... | |
StandardPathFile | openUser (Type type, const std::string &path, int flags) const |
Open the user file. | |
StandardPathFile | openSystem (Type type, const std::string &path, int flags) const |
Open the non-user file. More... | |
StandardPathTempFile | openUserTemp (Type type, const std::string &pathOrig) const |
Open user file, but create file with mktemp. | |
bool | safeSave (Type type, const std::string &pathOrig, const std::function< bool(int)> &callback) const |
Save the file safely with write and rename to make sure the operation is atomic. More... | |
std::vector< StandardPathFile > | openAll (Type type, const std::string &path, int flags) const |
Open all files match the first [directory]/[path]. | |
StandardPathFileMap | multiOpenFilter (Type type, const std::string &path, int flags, std::function< bool(const std::string &path, const std::string &dir, bool user)> filter) const |
Open all files match the filter under first [directory]/[path]. | |
template<typename... Args> | |
StandardPathFileMap | multiOpen (Type type, const std::string &path, int flags, Args... args) const |
Open all files match the filter under first [directory]/[path]. More... | |
StandardPathFilesMap | multiOpenAllFilter (Type type, const std::string &path, int flags, std::function< bool(const std::string &path, const std::string &dir, bool user)> filter) const |
Open all files match the filter under all [directory]/[path]. | |
template<typename... Args> | |
StandardPathFilesMap | multiOpenAll (Type type, const std::string &path, int flags, Args... args) const |
Open all files match the filter under all [directory]/[path]. More... | |
int64_t | timestamp (Type type, const std::string &path) const |
void | syncUmask () const |
Sync system umask to internal state. More... | |
Static Public Member Functions | |
static const StandardPath & | global () |
Return the global instance of StandardPath. More... | |
static const char * | fcitxPath (const char *path) |
Return fcitx specific path defined at compile time. More... | |
static std::string | fcitxPath (const char *path, const char *subPath) |
Return a path under specific fcitxPath directory. More... | |
static std::string | findExecutable (const std::string &name) |
Check if certain executable presents in PATH. More... | |
static bool | hasExecutable (const std::string &name) |
Check if certain executable presents in PATH. More... | |
Utility class to open, locate, list files based on XDG standard.
Definition at line 173 of file standardpath.h.