mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-11 12:56:53 -04:00
fix(system): we may get x86_64 when running 32-bit JVM in 64-bit Windows.
This commit is contained in:
parent
c5a43efafb
commit
b5484bb13b
@ -17,7 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.util.platform;
|
package org.jackhuang.hmcl.util.platform;
|
||||||
|
|
||||||
|
import org.jackhuang.hmcl.util.StringUtils;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.util.platform.Platform.BIT_32;
|
import static org.jackhuang.hmcl.util.platform.Platform.BIT_32;
|
||||||
import static org.jackhuang.hmcl.util.platform.Platform.BIT_64;
|
import static org.jackhuang.hmcl.util.platform.Platform.BIT_64;
|
||||||
@ -119,6 +122,25 @@ public enum Architecture {
|
|||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Architecture normalizeProcessorArchitecture() {
|
||||||
|
String processorArchitecture = System.getenv("PROCESSOR_ARCHITECTURE");
|
||||||
|
if (StringUtils.isBlank(processorArchitecture)) return null;
|
||||||
|
|
||||||
|
switch (processorArchitecture) {
|
||||||
|
case "AMD64":
|
||||||
|
case "EM64T":
|
||||||
|
return X86_64;
|
||||||
|
case "IA64":
|
||||||
|
return IA64;
|
||||||
|
case "ARM64":
|
||||||
|
return ARM64;
|
||||||
|
case "X86":
|
||||||
|
return X86;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static String normalize(String value) {
|
private static String normalize(String value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return "";
|
return "";
|
||||||
@ -129,6 +151,7 @@ public enum Architecture {
|
|||||||
static {
|
static {
|
||||||
SYSTEM_ARCHITECTURE = System.getProperty("os.arch");
|
SYSTEM_ARCHITECTURE = System.getProperty("os.arch");
|
||||||
|
|
||||||
CURRENT = normalizeArch(SYSTEM_ARCHITECTURE);
|
CURRENT = Optional.ofNullable(normalizeProcessorArchitecture())
|
||||||
|
.orElseGet(() -> normalizeArch(SYSTEM_ARCHITECTURE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user