Java version list should be sorted, JRE->JDK, 64->32
This commit is contained in:
parent
f3fffd5259
commit
a2b0941029
@ -139,9 +139,9 @@ QList<JavaVersionPtr> JavaUtils::FindJavaFromRegistryKey(DWORD keyType, QString
|
||||
return javas;
|
||||
}
|
||||
|
||||
QList<JavaVersionPtr> JavaUtils::FindJavaPaths()
|
||||
QList<QString> JavaUtils::FindJavaPaths()
|
||||
{
|
||||
QList<JavaVersionPtr> candidates;
|
||||
QList<JavaVersionPtr> java_candidates;
|
||||
|
||||
QList<JavaVersionPtr> JRE64s = this->FindJavaFromRegistryKey(
|
||||
KEY_WOW64_64KEY, "SOFTWARE\\JavaSoft\\Java Runtime Environment");
|
||||
@ -152,17 +152,26 @@ QList<JavaVersionPtr> JavaUtils::FindJavaPaths()
|
||||
QList<JavaVersionPtr> JDK32s = this->FindJavaFromRegistryKey(
|
||||
KEY_WOW64_32KEY, "SOFTWARE\\JavaSoft\\Java Development Kit");
|
||||
|
||||
candidates.append(JRE64s);
|
||||
candidates.append(JDK64s);
|
||||
candidates.append(JRE32s);
|
||||
candidates.append(JDK32s);
|
||||
java_candidates.append(JRE64s);
|
||||
java_candidates.append(JDK64s);
|
||||
java_candidates.append(JRE32s);
|
||||
java_candidates.append(JDK32s);
|
||||
|
||||
candidates.append(MakeJavaPtr("C:/Program Files/Java/jre7/bin/java.exe"));
|
||||
candidates.append(MakeJavaPtr("C:/Program Files/Java/jre6/bin/java.exe"));
|
||||
candidates.append(MakeJavaPtr("C:/Program Files (x86)/Java/jre7/bin/java.exe"));
|
||||
candidates.append(MakeJavaPtr("C:/Program Files (x86)/Java/jre6/bin/java.exe"));
|
||||
QList<QString> candidates;
|
||||
for(JavaVersionPtr java_candidate : java_candidates)
|
||||
{
|
||||
if(!candidates.contains(java_candidate->path))
|
||||
{
|
||||
candidates.append(java_candidate->path);
|
||||
}
|
||||
}
|
||||
|
||||
candidates.append(this->GetDefaultJava());
|
||||
candidates.append("C:/Program Files/Java/jre7/bin/java.exe");
|
||||
candidates.append("C:/Program Files/Java/jre6/bin/java.exe");
|
||||
candidates.append("C:/Program Files (x86)/Java/jre7/bin/java.exe");
|
||||
candidates.append("C:/Program Files (x86)/Java/jre6/bin/java.exe");
|
||||
|
||||
candidates.append(this->GetDefaultJava()->path);
|
||||
|
||||
return candidates;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
JavaUtils();
|
||||
|
||||
JavaVersionPtr MakeJavaPtr(QString path, QString id = "unknown", QString arch = "unknown");
|
||||
QList<JavaVersionPtr> FindJavaPaths();
|
||||
QList<QString> FindJavaPaths();
|
||||
JavaVersionPtr GetDefaultJava();
|
||||
|
||||
#if WINDOWS
|
||||
|
@ -174,28 +174,23 @@ void JavaListLoadTask::executeTask()
|
||||
{
|
||||
setStatus("Detecting Java installations...");
|
||||
|
||||
QSet<QString> candidate_paths;
|
||||
JavaUtils ju;
|
||||
|
||||
QList<JavaVersionPtr> candidates = ju.FindJavaPaths();
|
||||
|
||||
for(JavaVersionPtr &candidate : candidates)
|
||||
{
|
||||
candidate_paths.insert(candidate->path);
|
||||
}
|
||||
QList<QString> candidate_paths = ju.FindJavaPaths();
|
||||
|
||||
auto job = new JavaCheckerJob("Java detection");
|
||||
connect(job, SIGNAL(finished(QList<JavaCheckResult>)), this, SLOT(javaCheckerFinished(QList<JavaCheckResult>)));
|
||||
connect(job, SIGNAL(progress(int, int)), this, SLOT(checkerProgress(int, int)));
|
||||
|
||||
for(const QString candidate : candidate_paths)
|
||||
QLOG_DEBUG() << "Probing the following Java paths: ";
|
||||
for(QString candidate : candidate_paths)
|
||||
{
|
||||
QLOG_DEBUG() << " " << candidate;
|
||||
|
||||
auto candidate_checker = new JavaChecker();
|
||||
candidate_checker->path = candidate;
|
||||
job->addJavaCheckerAction(JavaCheckerPtr(candidate_checker));
|
||||
}
|
||||
|
||||
QLOG_DEBUG() << "Starting java checker job with" << job->size() << "candidates";
|
||||
job->start();
|
||||
}
|
||||
|
||||
@ -209,7 +204,7 @@ void JavaListLoadTask::javaCheckerFinished(QList<JavaCheckResult> results)
|
||||
{
|
||||
QList<JavaVersionPtr> candidates;
|
||||
|
||||
QLOG_DEBUG() << "Got Java checker results:";
|
||||
QLOG_DEBUG() << "Found the following valid Java installations:";
|
||||
for(JavaCheckResult result : results)
|
||||
{
|
||||
if(result.valid)
|
||||
@ -221,7 +216,7 @@ void JavaListLoadTask::javaCheckerFinished(QList<JavaCheckResult> results)
|
||||
javaVersion->path = result.path;
|
||||
candidates.append(javaVersion);
|
||||
|
||||
QLOG_DEBUG() << javaVersion->id << javaVersion->arch << javaVersion->path;
|
||||
QLOG_DEBUG() << " " << javaVersion->id << javaVersion->arch << javaVersion->path;
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,6 +233,5 @@ void JavaListLoadTask::javaCheckerFinished(QList<JavaCheckResult> results)
|
||||
}
|
||||
|
||||
m_list->updateListData(javas_bvp);
|
||||
|
||||
emitSucceeded();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user