aboutsummaryrefslogtreecommitdiff
path: root/src/config.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-10-23 13:04:03 +0200
committerdec05eba <dec05eba@protonmail.com>2023-10-23 13:04:03 +0200
commitbe1e3bad3fe5ce3eca7c0670ed98dada2ec1bd86 (patch)
tree901c78890d761c04d1c29bc68a92905986e78329 /src/config.hpp
parent39b4f8d4caa0025565f5c79115445263faab8756 (diff)
Use XDG_VIDEOS_DIR if available
Diffstat (limited to 'src/config.hpp')
-rw-r--r--src/config.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/config.hpp b/src/config.hpp
index f812c5a..be3fbf3 100644
--- a/src/config.hpp
+++ b/src/config.hpp
@@ -86,6 +86,17 @@ static std::string get_config_dir() {
return config_dir;
}
+static std::string get_videos_dir() {
+ std::string videos_dir;
+ const char *xdg_videos_dir = getenv("XDG_VIDEOS_DIR");
+ if(xdg_videos_dir) {
+ videos_dir = xdg_videos_dir;
+ } else {
+ videos_dir = get_home_dir() + "/Videos";
+ }
+ return videos_dir;
+}
+
static int create_directory_recursive(char *path) {
int path_len = strlen(path);
char *p = path;