aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/app/main.cpp37
-rw-r--r--src/plugins/qtsupport/qtoptionspage.cpp4
2 files changed, 27 insertions, 14 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index ee7ddbd2035..d56cc676020 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -244,22 +244,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()
diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp
index c0049058abd..9df0dd5068f 100644
--- a/src/plugins/qtsupport/qtoptionspage.cpp
+++ b/src/plugins/qtsupport/qtoptionspage.cpp
@@ -897,9 +897,9 @@ void QtOptionsPageWidget::apply()
&QtOptionsPageWidget::updateQtVersions);
}
-// TODO whenever we move the output of sdktool to a different location in the installer,
-// this needs to be adapted accordingly
const QStringList kSubdirsToCheck = {"",
+ "Tools/sdktool", // macOS
+ "Tools/sdktool/share/qtcreator", // Windows/Linux
"Qt Creator.app/Contents/Resources",
"Contents/Resources",
"Tools/QtCreator/share/qtcreator",