Skip to content

Commit

Permalink
Config: Fix plugin startup for fresh installs
Browse files Browse the repository at this point in the history
The commit to migrate data from global.ini to the plugin_config folder
accidentally broke plugin startup for fresh configurations. Instead of
returning early if no configuration is found, simply generate a new one
from defaults.

Closes #1225
  • Loading branch information
tt2468 committed Jun 6, 2024
1 parent 5b4aa9d commit 8c80e07
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ with this program. If not, see <https://www.gnu.org/licenses/>

void Config::Load(json config)
{
// Only load from plugin config directory if there hasn't been a migration
if (config.is_null()) {
std::string configFilePath = Utils::Obs::StringHelper::GetModuleConfigPath(CONFIG_FILE_NAME);
Utils::Json::GetJsonFileContent(configFilePath, config); // Fetch the existing config, which may not exist
}

// Should never happen, but just in case
if (!config.is_object())
return;
if (!config.is_object()) {
blog(LOG_INFO, "[Config::Load] Existing configuration not found, using defaults.");
config = json::object();
}

if (config.contains(PARAM_FIRSTLOAD) && config[PARAM_FIRSTLOAD].is_boolean())
FirstLoad = config[PARAM_FIRSTLOAD];
Expand Down

0 comments on commit 8c80e07

Please sign in to comment.