From 89d8f665b5c661a4b373f766692b3d68c3cd294f Mon Sep 17 00:00:00 2001 From: dranull <150595692+dranull@users.noreply.github.com> Date: Sat, 9 Dec 2023 18:27:30 +0000 Subject: [PATCH] config: Avoid regenerating config if --config is used (#4103) --- src/config/ConfigManager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 28f3b746..71841804 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1610,10 +1610,16 @@ void CConfigManager::loadConfigLoadVars() { ifs.open(mainConfigPath); if (!ifs.good()) { - Debug::log(WARN, "Config reading error. Attempting to generate, backing up old one if exists"); - ifs.close(); + if (!g_pCompositor->explicitConfigPath.empty()) { + Debug::log(WARN, "Config reading error!"); + parseError = "Broken config file! (Could not read)"; + return; + } + + Debug::log(WARN, "Config reading error. Attempting to generate, backing up old one if exists"); + if (std::filesystem::exists(mainConfigPath)) std::filesystem::rename(mainConfigPath, mainConfigPath + ".backup");