From 3636cf57abd98b70d0a5d244b8e991fe53bca358 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 5 Sep 2016 15:45:37 +0100 Subject: [PATCH] =?utf8?q?Adjust=20behaviour=20of=20=E2=80=94no-default-co?= =?utf8?q?nfig=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Still read autosave and preferences.xml in this case, but skip all config files (.fgfsrc, etc) --- src/Main/fg_init.cxx | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index eadfa155d..8537fc373 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -462,28 +462,21 @@ int fgInitConfig ( int argc, char **argv, bool reinit ) if (!reinit) { options->init(argc, argv, dataPath); } - - bool loadDefaults = options->shouldLoadDefaultConfig(); - if (loadDefaults) { - // Read global preferences from $FG_ROOT/preferences.xml - SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences"); - fgLoadProps("preferences.xml", globals->get_props()); - SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences"); - - // do not load user settings when reset to default is requested, or if - // told to explicitly ignore - if (options->isOptionSet("restore-defaults") || options->isOptionSet("ignore-autosave")) - { - SG_LOG(SG_GENERAL, SG_ALERT, "Ignoring user settings. Restoring defaults."); - } - else - { - globals->loadUserSettings(dataPath); - } + + // Read global preferences from $FG_ROOT/preferences.xml + SG_LOG(SG_GENERAL, SG_INFO, "Reading global preferences"); + fgLoadProps("preferences.xml", globals->get_props()); + SG_LOG(SG_GENERAL, SG_INFO, "Finished Reading global preferences"); + + // do not load user settings when reset to default is requested, or if + // told to explicitly ignore + if (options->isOptionSet("restore-defaults") || options->isOptionSet("ignore-autosave")) + { + SG_LOG(SG_GENERAL, SG_ALERT, "Ignoring user settings. Restoring defaults."); } else { - SG_LOG(SG_GENERAL, SG_INFO, "not reading default configuration files"); - }// of no-default-config selected - + globals->loadUserSettings(dataPath); + } + return flightgear::FG_OPTIONS_OK; } -- 2.39.5