Treat empty XDG_CACHE_HOME same as unset

This matches the XDG base directory spec.
This commit is contained in:
ShadowNinja 2021-12-01 18:33:55 -05:00 committed by rubenwardy
parent ea2fba877a
commit 88b21a72f1

@ -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