diff options
author | Eike Ziller <eike.ziller@qt.io> | 2022-10-18 10:48:46 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2022-10-18 10:48:46 +0200 |
commit | ea5a050c5cddc72572d15c092217451f224c4153 (patch) | |
tree | 59aa1b38a6ba31757ac8443352683c1b36585838 /src/app/main.cpp | |
parent | ce6ab1a14d59acdf19860a446055130a179b76f6 (diff) | |
parent | 6276f5514da089c6f56d6746bd56717f162a8041 (diff) |
Merge remote-tracking branch 'origin/8.0' into 9.0
Conflicts:
src/plugins/mcusupport/mcusupportsdk.cpp
src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
src/plugins/qmldesigner/components/materialbrowser/bundleimporter.cpp
src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp
Change-Id: I9317da0fc1243b9ce6d87f577aa843c51f132ad7
Diffstat (limited to 'src/app/main.cpp')
-rw-r--r-- | src/app/main.cpp | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp index db8ce6bde8..fbb02042c6 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -220,22 +220,35 @@ static void setupInstallSettings(QString &installSettingspath) QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR), QLatin1String(Core::Constants::IDE_CASED_ID))); installSettingspath.clear(); } - // Check if the default install settings contain a setting for the actual install settings. - // This can be an absolute path, or a path relative to applicationDirPath(). - // The result is interpreted like -settingspath, but for SystemScope static const char kInstallSettingsKey[] = "Settings/InstallSettings"; QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, installSettingspath.isEmpty() ? resourcePath() : installSettingspath); - QSettings installSettings(QSettings::IniFormat, QSettings::UserScope, - QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR), - QLatin1String(Core::Constants::IDE_CASED_ID)); - if (installSettings.contains(kInstallSettingsKey)) { - QString installSettingsPath = installSettings.value(kInstallSettingsKey).toString(); - if (QDir::isRelativePath(installSettingsPath)) - installSettingsPath = applicationDirPath() + '/' + installSettingsPath; - QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, installSettingsPath); - } + // Check if the default install settings contain a setting for the actual install settings. + // This can be an absolute path, or a path relative to applicationDirPath(). + // The result is interpreted like -settingspath, but for SystemScope. + // + // Through the sdktool split that is upcoming, the new install settings might redirect + // yet a second time. So try this a few times. + // (Only the first time with QSettings::UserScope, to allow setting the install settings path + // in the user settings.) + QSettings::Scope scope = QSettings::UserScope; + int count = 0; + bool containsInstallSettingsKey = false; + do { + QSettings installSettings(QSettings::IniFormat, scope, + QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR), + QLatin1String(Core::Constants::IDE_CASED_ID)); + containsInstallSettingsKey = installSettings.contains(kInstallSettingsKey); + if (containsInstallSettingsKey) { + QString newInstallSettingsPath = installSettings.value(kInstallSettingsKey).toString(); + if (QDir::isRelativePath(newInstallSettingsPath)) + newInstallSettingsPath = applicationDirPath() + '/' + newInstallSettingsPath; + QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, newInstallSettingsPath); + } + scope = QSettings::SystemScope; // UserScope only the first time we check + ++count; + } while (containsInstallSettingsKey && count < 3); } static Utils::QtcSettings *createUserSettings() |