summaryrefslogtreecommitdiffstats
path: root/logic/JavaUtils.cpp
diff options
context:
space:
mode:
authorSky <git@bunnies.cc>2013-12-12 14:56:32 +0000
committerSky <git@bunnies.cc>2013-12-12 14:56:32 +0000
commita2b094102999af646dd1dd962ced435197466b97 (patch)
treead266856e27129a83e671d7e492eb14ebe0410c1 /logic/JavaUtils.cpp
parentf3fffd52594065995d4c355de1571b36b2f2bbeb (diff)
downloadMultiMC-a2b094102999af646dd1dd962ced435197466b97.tar
MultiMC-a2b094102999af646dd1dd962ced435197466b97.tar.gz
MultiMC-a2b094102999af646dd1dd962ced435197466b97.tar.lz
MultiMC-a2b094102999af646dd1dd962ced435197466b97.tar.xz
MultiMC-a2b094102999af646dd1dd962ced435197466b97.zip
Java version list should be sorted, JRE->JDK, 64->32
Diffstat (limited to 'logic/JavaUtils.cpp')
-rw-r--r--logic/JavaUtils.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/logic/JavaUtils.cpp b/logic/JavaUtils.cpp
index 77972874..91463688 100644
--- a/logic/JavaUtils.cpp
+++ b/logic/JavaUtils.cpp
@@ -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);
+
+ QList<QString> candidates;
+ for(JavaVersionPtr java_candidate : java_candidates)
+ {
+ if(!candidates.contains(java_candidate->path))
+ {
+ candidates.append(java_candidate->path);
+ }
+ }
- 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"));
+ 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());
+ candidates.append(this->GetDefaultJava()->path);
return candidates;
}