forked from qt-creator/qt-creator
Android: Fix default JDK path discovery
Task-number: QTCREATORBUG-18691 Change-Id: Ibd17e7edf1c2cfdcc54ff2b9f16a9125bb217a84 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
@@ -70,6 +70,7 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -82,7 +83,7 @@ namespace Android {
|
|||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
const char jdkSettingsPath[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit";
|
||||||
const QVersionNumber sdkToolsAntMissingVersion(25, 3, 0);
|
const QVersionNumber sdkToolsAntMissingVersion(25, 3, 0);
|
||||||
|
|
||||||
const QLatin1String SettingsGroup("AndroidConfigurations");
|
const QLatin1String SettingsGroup("AndroidConfigurations");
|
||||||
@@ -1247,8 +1248,18 @@ void AndroidConfigurations::load()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (HostOsInfo::isWindowsHost()) {
|
} else if (HostOsInfo::isWindowsHost()) {
|
||||||
QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Javasoft\\Java Development Kit"), QSettings::NativeFormat);
|
QStringList allVersions;
|
||||||
QStringList allVersions = settings.childGroups();
|
std::unique_ptr<QSettings> settings(new QSettings(jdkSettingsPath,
|
||||||
|
QSettings::NativeFormat));
|
||||||
|
allVersions = settings->childGroups();
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
|
if (allVersions.isEmpty()) {
|
||||||
|
settings.reset(new QSettings(jdkSettingsPath, QSettings::Registry64Format));
|
||||||
|
allVersions = settings->childGroups();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
QString javaHome;
|
QString javaHome;
|
||||||
int major = -1;
|
int major = -1;
|
||||||
int minor = -1;
|
int minor = -1;
|
||||||
@@ -1264,9 +1275,9 @@ void AndroidConfigurations::load()
|
|||||||
if (tmpMajor > major
|
if (tmpMajor > major
|
||||||
|| (tmpMajor == major
|
|| (tmpMajor == major
|
||||||
&& tmpMinor > minor)) {
|
&& tmpMinor > minor)) {
|
||||||
settings.beginGroup(version);
|
settings->beginGroup(version);
|
||||||
QString tmpJavaHome = settings.value(QLatin1String("JavaHome")).toString();
|
QString tmpJavaHome = settings->value(QLatin1String("JavaHome")).toString();
|
||||||
settings.endGroup();
|
settings->endGroup();
|
||||||
if (!QFileInfo::exists(tmpJavaHome))
|
if (!QFileInfo::exists(tmpJavaHome))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user