config: Avoid regenerating config if --config is used (#4103)

This commit is contained in:
dranull 2023-12-09 18:27:30 +00:00 committed by GitHub
parent 9132660768
commit 89d8f665b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1610,10 +1610,16 @@ void CConfigManager::loadConfigLoadVars() {
ifs.open(mainConfigPath); ifs.open(mainConfigPath);
if (!ifs.good()) { if (!ifs.good()) {
Debug::log(WARN, "Config reading error. Attempting to generate, backing up old one if exists");
ifs.close(); 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)) if (std::filesystem::exists(mainConfigPath))
std::filesystem::rename(mainConfigPath, mainConfigPath + ".backup"); std::filesystem::rename(mainConfigPath, mainConfigPath + ".backup");