mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-24 12:16:28 +01:00
Possibly improve detection of 32-bit/64-bit.
This commit is contained in:
parent
300c8167d8
commit
c1cbff754e
@ -11,6 +11,7 @@ import com.skcraft.launcher.util.Platform;
|
|||||||
import com.skcraft.launcher.util.WinRegistry;
|
import com.skcraft.launcher.util.WinRegistry;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -49,7 +50,8 @@ public final class JavaRuntimeFinder {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getEntriesFromRegistry(List<JREEntry> entries, String basePath) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
|
private static void getEntriesFromRegistry(List<JREEntry> entries, String basePath)
|
||||||
|
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
|
||||||
List<String> subKeys = WinRegistry.readStringSubKeys(WinRegistry.HKEY_LOCAL_MACHINE, basePath);
|
List<String> subKeys = WinRegistry.readStringSubKeys(WinRegistry.HKEY_LOCAL_MACHINE, basePath);
|
||||||
for (String subKey : subKeys) {
|
for (String subKey : subKeys) {
|
||||||
JREEntry entry = getEntryFromRegistry(basePath, subKey);
|
JREEntry entry = getEntryFromRegistry(basePath, subKey);
|
||||||
@ -75,8 +77,12 @@ public final class JavaRuntimeFinder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean guessIf64Bit(File path) {
|
private static boolean guessIf64Bit(File path) {
|
||||||
|
try {
|
||||||
String programFilesX86 = System.getenv("ProgramFiles(x86)");
|
String programFilesX86 = System.getenv("ProgramFiles(x86)");
|
||||||
return programFilesX86 == null || !path.toString().startsWith(new File(programFilesX86).toString());
|
return programFilesX86 == null || !path.getCanonicalPath().startsWith(new File(programFilesX86).getCanonicalPath());
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class JREEntry implements Comparable<JREEntry> {
|
private static class JREEntry implements Comparable<JREEntry> {
|
||||||
|
Loading…
Reference in New Issue
Block a user