From f55fe0fc45dda5f85d3e93d3f92cb8a5470ac654 Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Wed, 19 May 2021 00:45:21 +0800 Subject: [PATCH] fix: Compilation Error --- .../main/java/org/jackhuang/hmcl/game/LauncherHelper.java | 6 ++---- .../main/java/org/jackhuang/hmcl/game/OSRestriction.java | 3 ++- .../java/org/jackhuang/hmcl/util/platform/Platform.java | 7 +------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java index 03773317f..2c123f232 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java @@ -54,10 +54,8 @@ import org.jackhuang.hmcl.util.*; import org.jackhuang.hmcl.util.gson.UUIDTypeAdapter; import org.jackhuang.hmcl.util.i18n.I18n; import org.jackhuang.hmcl.util.io.ResponseCodeException; -import org.jackhuang.hmcl.util.platform.CommandBuilder; +import org.jackhuang.hmcl.util.platform.*; import org.jackhuang.hmcl.util.platform.JavaVersion; -import org.jackhuang.hmcl.util.platform.ManagedProcess; -import org.jackhuang.hmcl.util.platform.OperatingSystem; import org.jackhuang.hmcl.util.versioning.VersionNumber; import java.io.File; @@ -373,7 +371,7 @@ public final class LauncherHelper { } if (!flag && java.getPlatform() == org.jackhuang.hmcl.util.platform.Platform.BIT_32 && - org.jackhuang.hmcl.util.platform.Platform.IS_64_BIT) { + Architecture.CURRENT.getPlatform() == org.jackhuang.hmcl.util.platform.Platform.BIT_64) { final JavaVersion java32 = java; // First find if same java version but whose platform is 64-bit installed. diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/OSRestriction.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/OSRestriction.java index cd860b15e..8e7ab31f0 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/OSRestriction.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/OSRestriction.java @@ -18,6 +18,7 @@ package org.jackhuang.hmcl.game; import org.jackhuang.hmcl.util.Lang; +import org.jackhuang.hmcl.util.platform.Architecture; import org.jackhuang.hmcl.util.platform.OperatingSystem; import java.util.regex.Pattern; @@ -71,7 +72,7 @@ public final class OSRestriction { return false; if (arch != null) - return !Lang.test(() -> !Pattern.compile(arch).matcher(OperatingSystem.SYSTEM_ARCHITECTURE).matches()); + return !Lang.test(() -> !Pattern.compile(arch).matcher(Architecture.SYSTEM_ARCHITECTURE).matches()); return true; } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Platform.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Platform.java index 738808b5b..eac2db089 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Platform.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Platform.java @@ -44,15 +44,10 @@ public enum Platform { return bit; } - /** - * True if current Java Environment is 64-bit. - */ - public static final boolean IS_64_BIT = OperatingSystem.SYSTEM_ARCHITECTURE.contains("64"); - /** * The platform of current Java Environment. */ - public static final Platform PLATFORM = IS_64_BIT ? BIT_64 : BIT_32; + public static final Platform PLATFORM = Architecture.CURRENT.getPlatform(); /** * The json serializer to {@link Platform}.