mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-18 00:10:33 -04:00
Remove unnecessary code
This commit is contained in:
parent
3bbe422421
commit
670d0f8462
@ -546,10 +546,7 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
|
|||||||
memoryStatus.set(OperatingSystem.getPhysicalMemoryStatus().orElse(OperatingSystem.PhysicalMemoryStatus.INVALID));
|
memoryStatus.set(OperatingSystem.getPhysicalMemoryStatus().orElse(OperatingSystem.PhysicalMemoryStatus.INVALID));
|
||||||
|
|
||||||
Task.supplyAsync(JavaVersion::getJavas).thenAcceptAsync(Schedulers.javafx(), list -> {
|
Task.supplyAsync(JavaVersion::getJavas).thenAcceptAsync(Schedulers.javafx(), list -> {
|
||||||
boolean isX86 = (Architecture.SYSTEM_ARCH.isX86())
|
boolean isX86 = Architecture.SYSTEM_ARCH.isX86() && list.stream().allMatch(java -> java.getArchitecture().isX86());
|
||||||
&& list.stream().allMatch(java -> java.getArchitecture().isX86());
|
|
||||||
|
|
||||||
// boolean showSystem = list.stream().anyMatch(java -> java.getPlatform().getOperatingSystem() != OperatingSystem.CURRENT_OS);
|
|
||||||
|
|
||||||
List<MultiFileItem.Option<JavaVersion>> options = list.stream()
|
List<MultiFileItem.Option<JavaVersion>> options = list.stream()
|
||||||
.map(javaVersion -> new MultiFileItem.Option<>(
|
.map(javaVersion -> new MultiFileItem.Option<>(
|
||||||
|
@ -105,8 +105,8 @@ public enum JavaVersionConstraint {
|
|||||||
public boolean appliesToVersion(@Nullable VersionNumber gameVersionNumber, @Nullable Version version,
|
public boolean appliesToVersion(@Nullable VersionNumber gameVersionNumber, @Nullable Version version,
|
||||||
@Nullable JavaVersion javaVersion) {
|
@Nullable JavaVersion javaVersion) {
|
||||||
return getGameVersionRange().contains(gameVersionNumber)
|
return getGameVersionRange().contains(gameVersionNumber)
|
||||||
&& Architecture.SYSTEM_ARCH != Architecture.X86 && Architecture.SYSTEM_ARCH != Architecture.X86_64
|
&& javaVersion != null
|
||||||
&& (javaVersion != null && (javaVersion.getArchitecture() != Architecture.X86 && javaVersion.getArchitecture() != Architecture.X86_64));
|
&& !javaVersion.getArchitecture().isX86();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,7 +97,6 @@ public final class JavaVersion {
|
|||||||
private static final Pattern REGEX = Pattern.compile("version \"(?<version>(.*?))\"");
|
private static final Pattern REGEX = Pattern.compile("version \"(?<version>(.*?))\"");
|
||||||
private static final Pattern VERSION = Pattern.compile("^(?<version>[0-9]+)");
|
private static final Pattern VERSION = Pattern.compile("^(?<version>[0-9]+)");
|
||||||
|
|
||||||
private static final Pattern OS_NAME = Pattern.compile("os\\.name = (?<name>.*)");
|
|
||||||
private static final Pattern OS_ARCH = Pattern.compile("os\\.arch = (?<arch>.*)");
|
private static final Pattern OS_ARCH = Pattern.compile("os\\.arch = (?<arch>.*)");
|
||||||
private static final Pattern JAVA_VERSION = Pattern.compile("java\\.version = (?<version>.*)");
|
private static final Pattern JAVA_VERSION = Pattern.compile("java\\.version = (?<version>.*)");
|
||||||
|
|
||||||
@ -132,7 +131,6 @@ public final class JavaVersion {
|
|||||||
if (cachedJavaVersion != null)
|
if (cachedJavaVersion != null)
|
||||||
return cachedJavaVersion;
|
return cachedJavaVersion;
|
||||||
|
|
||||||
String osName = null;
|
|
||||||
String osArch = null;
|
String osArch = null;
|
||||||
String version = null;
|
String version = null;
|
||||||
|
|
||||||
@ -143,20 +141,10 @@ public final class JavaVersion {
|
|||||||
for (String line; (line = reader.readLine()) != null; ) {
|
for (String line; (line = reader.readLine()) != null; ) {
|
||||||
Matcher m;
|
Matcher m;
|
||||||
|
|
||||||
m = OS_NAME.matcher(line);
|
|
||||||
if (m.find()) {
|
|
||||||
osName = m.group("name");
|
|
||||||
if (osArch != null && version != null) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m = OS_ARCH.matcher(line);
|
m = OS_ARCH.matcher(line);
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
osArch = m.group("arch");
|
osArch = m.group("arch");
|
||||||
if (osName != null && version != null) {
|
if (version != null) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
@ -166,7 +154,7 @@ public final class JavaVersion {
|
|||||||
m = JAVA_VERSION.matcher(line);
|
m = JAVA_VERSION.matcher(line);
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
version = m.group("version");
|
version = m.group("version");
|
||||||
if (osName != null && osArch != null) {
|
if (osArch != null) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
//noinspection UnnecessaryContinue
|
//noinspection UnnecessaryContinue
|
||||||
@ -176,8 +164,8 @@ public final class JavaVersion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osName != null && osArch != null) {
|
if (osArch != null) {
|
||||||
platform = Platform.getPlatform(OperatingSystem.parseOSName(osName), Architecture.parseArchName(osArch));
|
platform = Platform.getPlatform(OperatingSystem.CURRENT_OS, Architecture.parseArchName(osArch));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user