File tree Expand file tree Collapse file tree
HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 */
1818package org .jackhuang .hmcl .util .platform ;
1919
20+ import java .nio .file .Files ;
21+ import java .nio .file .Path ;
22+
2023public record Platform (OperatingSystem os , Architecture arch ) {
2124 public static final Platform UNKNOWN = new Platform (OperatingSystem .UNKNOWN , Architecture .UNKNOWN );
2225
@@ -41,6 +44,18 @@ public record Platform(OperatingSystem os, Architecture arch) {
4144 public static final Platform CURRENT_PLATFORM = Platform .getPlatform (OperatingSystem .CURRENT_OS , Architecture .CURRENT_ARCH );
4245 public static final Platform SYSTEM_PLATFORM = Platform .getPlatform (OperatingSystem .CURRENT_OS , Architecture .SYSTEM_ARCH );
4346
47+ private static final boolean SUPPORTED_TRANSLATION_X86_64 ;
48+
49+ static {
50+ if (SYSTEM_PLATFORM .equals (WINDOWS_ARM64 )) {
51+ SUPPORTED_TRANSLATION_X86_64 = OperatingSystem .SYSTEM_BUILD_NUMBER >= 21277 ;
52+ } else if (SYSTEM_PLATFORM .equals (MACOS_ARM64 )) {
53+ SUPPORTED_TRANSLATION_X86_64 = Files .isRegularFile (Path .of ("/usr/libexec/rosetta/runtime" ));
54+ } else {
55+ SUPPORTED_TRANSLATION_X86_64 = false ;
56+ }
57+ }
58+
4459 public static boolean isCompatibleWithX86Java () {
4560 return Architecture .SYSTEM_ARCH .isX86 () || SYSTEM_PLATFORM .equals (MACOS_ARM64 ) || SYSTEM_PLATFORM .equals (WINDOWS_ARM64 );
4661 }
You can’t perform that action at this time.
0 commit comments