From 1dc8cd8eef20bae4af2471e9102652e440b87543 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 11 Mar 2025 08:44:44 +0100 Subject: [PATCH] config/Path: allow expanding $HOME even without XDG --- src/config/Path.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/Path.cxx b/src/config/Path.cxx index 8b63fd47a..ef7039791 100644 --- a/src/config/Path.cxx +++ b/src/config/Path.cxx @@ -93,7 +93,6 @@ ParsePath(const char *path) return GetHome(std::string{user}.c_str()) / AllocatedPath::FromUTF8Throw(rest); } -#ifdef USE_XDG } else if (path[0] == '$') { ++path; @@ -102,6 +101,7 @@ ParsePath(const char *path) AllocatedPath xdg_path(nullptr); if (env_var == "HOME"sv) { xdg_path = GetConfiguredHome(); +#ifdef USE_XDG } else if (env_var == "XDG_CONFIG_HOME"sv) { xdg_path = GetUserConfigDir(); } else if (env_var == "XDG_MUSIC_DIR"sv) { @@ -110,12 +110,12 @@ ParsePath(const char *path) xdg_path = GetUserCacheDir(); } else if (env_var == "XDG_RUNTIME_DIR"sv) { xdg_path = GetUserRuntimeDir(); +#endif } else { throw FmtRuntimeError("Unknown variable: {:?}", env_var); } return xdg_path / AllocatedPath::FromUTF8Throw(rest); -#endif } else if (!PathTraitsUTF8::IsAbsolute(path)) { throw FmtRuntimeError("not an absolute path: {:?}", path); } else {