diff options
author | Maximilian Seidler <[email protected]> | 2024-10-19 14:49:56 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-19 15:49:56 +0100 |
commit | e5d3a71263187feec6c2249b3f7b74de0a71f47c (patch) | |
tree | b6f5e4519f28e88f729970519763790adb2c1ede | |
parent | 0e630e9e74ad34683194a07cfe6afe55a2c0685f (diff) | |
download | Hyprland-e5d3a71263187feec6c2249b3f7b74de0a71f47c.tar.gz Hyprland-e5d3a71263187feec6c2249b3f7b74de0a71f47c.zip |
config: fix generateConfig loop (#8164)
* config: fix generateConfig loop
* config: cleanup getMainConfigPath
-rw-r--r-- | src/config/ConfigManager.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 6ec63d4c..432b7faf 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -688,14 +688,13 @@ std::string CConfigManager::getMainConfigPath() { if (const auto CFG_ENV = getenv("HYPRLAND_CONFIG"); CFG_ENV) return CFG_ENV; - Debug::log(TRACE, "Seems as if HYPRLAND_CONFIG isn't set, let's see what we can do with HOME."); - - static const auto paths = Hyprutils::Path::findConfig(ISDEBUG ? "hyprlandd" : "hyprland"); - if (paths.first.has_value()) { - return paths.first.value(); - } else if (paths.second.has_value()) { - auto configPath = Hyprutils::Path::fullConfigPath(paths.second.value(), ISDEBUG ? "hyprlandd" : "hyprland"); - return generateConfig(configPath).value(); + + const auto PATHS = Hyprutils::Path::findConfig(ISDEBUG ? "hyprlandd" : "hyprland"); + if (PATHS.first.has_value()) { + return PATHS.first.value(); + } else if (PATHS.second.has_value()) { + const auto CONFIGPATH = Hyprutils::Path::fullConfigPath(PATHS.second.value(), ISDEBUG ? "hyprlandd" : "hyprland"); + return generateConfig(CONFIGPATH).value(); } else throw std::runtime_error("Neither HOME nor XDG_CONFIG_HOME are set in the environment. Could not find config in XDG_CONFIG_DIRS or /etc/xdg."); } |