25 enum XDG_Name : std::size_t {
36 std::string_view varName;
37 std::string_view defaultPath;
41 using XDG_Env_Var_List = std::array<XDG_Env_Spec, 6>;
43 using XDG_Path_Set = std::vector<std::filesystem::path>;
45 using XDG_Paths = std::map<XDG_Name, XDG_Path_Set>;
48 static constexpr XDG_Env_Var_List mEnvVars = {
49 XDG_Env_Spec{XDG_DATA_HOME,
"XDG_DATA_HOME",
".local/share",
true},
50 XDG_Env_Spec{XDG_CONFIG_HOME,
"XDG_CONFIG_HOME",
".config",
true},
51 XDG_Env_Spec{XDG_DATA_DIRS,
"XDG_DATA_DIRS",
"/usr/local/share/:/usr/share/",
false},
52 XDG_Env_Spec{XDG_CONFIG_DIRS,
"XDG_CONFIG_DIRS",
"/etc/xdg",
false},
53 XDG_Env_Spec{XDG_CACHE_HOME,
"XDG_CACHE_HOME",
".cache",
true},
54 XDG_Env_Spec{XDG_RUNTIME_DIR,
"XDG_RUNTIME_DIR",
"",
false}
76 std::tuple<bool,std::filesystem::path>
findFilePath(XDG_Name name,
const S &relativePath) {
77 for (
auto const &path :
mPaths[name]) {
79 tryPath.append(relativePath);
80 if (std::filesystem::exists(tryPath))
81 return std::make_tuple(
true,tryPath);
84 auto preferredPath{
mPaths[name].front()};
85 preferredPath.append(relativePath);
86 return std::make_tuple(
false, preferredPath);
Definition: XDGFilePaths.h:34
std::tuple< bool, std::filesystem::path > findFilePath(XDG_Name name, const S &relativePath)
Search for a relative path on one of the XDG standard locations.
Definition: XDGFilePaths.h:76
XDG_Paths mPaths
All the XDG specified paths.
Definition: XDGFilePaths.h:57
std::string mHome
User's home directory.
Definition: XDGFilePaths.h:59
A class to determine and provide searching of XDG standard files paths.
Definition: XDGFilePaths.h:23
ToDo: There is an issue that the initial scroll interaction is lost if the click/press lands on a Wid...
Definition: CelestialOverlay.cpp:13