From a115f89ed2f4b3446524df1d64b18fa0241ea0b4 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 27 Jul 2016 12:41:02 +0200 Subject: [PATCH] Changed: Get language and installation directory from registry, see #279 --- .../client/ryzom_installer/src/configfile.cpp | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index c5981808b..953266b15 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -655,9 +655,11 @@ QString CConfigFile::getOldInstallationLanguage() QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Nevrax\\Ryzom", QSettings::NativeFormat); #endif - if (settings.contains("Language")) + QString key = "Language"; + + if (settings.contains(key)) { - QString languageCode = settings.value("Language").toString(); + QString languageCode = settings.value(key).toString(); // 1036 = French (France), 1033 = English (USA), 1031 = German if (languageCode == "1036") return "fr"; @@ -673,16 +675,18 @@ QString CConfigFile::getNewInstallationLanguage() { #if defined(Q_OS_WIN) // NSIS new official installer -#ifdef Q_OS_WIN64 - // use WOW6432Node in 64 bits (64 bits OS and 64 bits Installer) because Ryzom old installer was in 32 bits - QSettings settings("HKEY_LOCAL_MACHINE\\Software\\WOW6432Node\\Nevrax\\Ryzom", QSettings::NativeFormat); -#else - QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Nevrax\\Ryzom", QSettings::NativeFormat); -#endif + QSettings settings("HKEY_CURRENT_USER\\Software\\Winch Gate\\Ryzom", QSettings::NativeFormat); - if (settings.contains("Ryzom Install Path")) + QString key = "Language"; + + if (settings.contains(key)) { - return QDir::fromNativeSeparators(settings.value("Ryzom Install Path").toString()); + QString languageCode = settings.value(key).toString(); + + // 1036 = French (France), 1033 = English (USA), 1031 = German + if (languageCode == "1036") return "fr"; + if (languageCode == "1031") return "de"; + if (languageCode == "1033") return "en"; } #endif @@ -691,6 +695,19 @@ QString CConfigFile::getNewInstallationLanguage() QString CConfigFile::getNewInstallationDirectory() { +#if defined(Q_OS_WIN) + // NSIS new official installer + QSettings settings("HKEY_CURRENT_USER\\Software\\Winch Gate\\Ryzom", QSettings::NativeFormat); + + QString key = "Ryzom Install Path"; + + if (settings.contains(key)) + { + return QDir::fromNativeSeparators(settings.value(key).toString()); + } +#endif + + // default location return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); }