Skip to content

Commit

Permalink
Treat empty XDG_CACHE_HOME same as unset
Browse files Browse the repository at this point in the history
This matches the XDG base directory spec.
  • Loading branch information
ShadowNinja authored and rubenwardy committed Apr 8, 2022
1 parent ea2fba8 commit 88b21a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/porting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 88b21a7

Please sign in to comment.