aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2021-12-01 18:33:55 -0500
committerrubenwardy <rw@rubenwardy.com>2022-04-08 14:55:21 +0100
commit88b21a72f18db6a94e58a8047c4dec6160327e73 (patch)
tree9ffb6b241edf83b01a0f206d57dfe37b26efebf3
parentea2fba877a6d1d1170bc64bc9586edb615da584d (diff)
downloadminetest-88b21a72f18db6a94e58a8047c4dec6160327e73.tar.gz
minetest-88b21a72f18db6a94e58a8047c4dec6160327e73.tar.bz2
minetest-88b21a72f18db6a94e58a8047c4dec6160327e73.zip
Treat empty XDG_CACHE_HOME same as unset
This matches the XDG base directory spec.
-rw-r--r--src/porting.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/porting.cpp b/src/porting.cpp
index caf9e9be3..09627431c 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -608,7 +608,7 @@ void initializePaths()
// First try $XDG_CACHE_HOME/PROJECT_NAME
const char *cache_dir = getenv("XDG_CACHE_HOME");
const char *home_dir = getenv("HOME");
- if (cache_dir) {
+ if (cache_dir && cache_dir[0] != '\0') {
path_cache = std::string(cache_dir) + DIR_DELIM + PROJECT_NAME;
} else if (home_dir) {
// Then try $HOME/.cache/PROJECT_NAME