aboutsummaryrefslogtreecommitdiff
path: root/src/Storage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Storage.cpp')
-rw-r--r--src/Storage.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/Storage.cpp b/src/Storage.cpp
index 375be57..4baca49 100644
--- a/src/Storage.cpp
+++ b/src/Storage.cpp
@@ -82,12 +82,35 @@ namespace QuickMedia {
return homeDir;
}
+ static Path xdg_config_home;
+ static Path xdg_cache_home;
+
Path get_storage_dir() {
- return get_home_dir().join(".config").join("quickmedia");
+ if(xdg_config_home.data.empty()) {
+ const char *xdg_config_home_p = getenv("XDG_CONFIG_HOME");
+ if(xdg_config_home_p)
+ xdg_config_home = xdg_config_home_p;
+ else
+ xdg_config_home = get_home_dir().join(".config");
+ }
+
+ Path storage_dir = xdg_config_home;
+ storage_dir.join("quickmedia");
+ return storage_dir;
}
Path get_cache_dir() {
- return get_home_dir().join(".cache").join("quickmedia");
+ if(xdg_cache_home.data.empty()) {
+ const char *xdg_cache_home_p = getenv("XDG_CACHE_HOME");
+ if(xdg_cache_home_p)
+ xdg_cache_home = xdg_cache_home_p;
+ else
+ xdg_cache_home = get_home_dir().join(".cache");
+ }
+
+ Path cache_dir = xdg_cache_home;
+ cache_dir.join("quickmedia");
+ return cache_dir;
}
int get_cookies_filepath(Path &path, const std::string &plugin_name) {