diff --git a/src/GUI/SetupRootDialog.cxx b/src/GUI/SetupRootDialog.cxx index 14a159f25..756380878 100644 --- a/src/GUI/SetupRootDialog.cxx +++ b/src/GUI/SetupRootDialog.cxx @@ -18,9 +18,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "SetupRootDialog.hxx" @@ -42,6 +40,12 @@ #include #include +static QString rootPathKey() +{ + // return a settings key like fg-root-2018-3-0 + return QString("fg-root-") + QString(FLIGHTGEAR_VERSION).replace('.', '-'); +} + SetupRootDialog::SetupRootDialog(PromptState prompt) : QDialog(), m_promptState(prompt) @@ -90,10 +94,11 @@ bool SetupRootDialog::runDialog(PromptState prompt) return true; } + SGPath SetupRootDialog::restoreUserSelectedRoot() { QSettings settings; - QString path = settings.value("fg-root").toString(); + QString path = settings.value(rootPathKey()).toString(); if (path == "!ask") { bool ok = runDialog(ManualChoiceRequested); Q_ASSERT(ok); @@ -193,7 +198,7 @@ void SetupRootDialog::onBrowse() globals->set_fg_root(m_browsedPath.toStdString()); QSettings settings; - settings.setValue("fg-root", m_browsedPath); + settings.setValue(rootPathKey(), m_browsedPath); accept(); // we're done } diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 09553f297..44ed51133 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -2918,7 +2918,7 @@ void Options::setupRoot(int argc, char **argv) } else { // Next check if fg-root is set as an env variable char *envp = ::getenv( "FG_ROOT" ); - if ( envp != NULL ) { + if ( envp != nullptr ) { root = SGPath::fromLocal8Bit(envp); SG_LOG(SG_GENERAL, SG_INFO, "set from FG_ROOT env var: fg_root = " << root ); } else {