From ca08bbda347b36b99c8067af7a124e719102527a Mon Sep 17 00:00:00 2001 From: Henry Le Grys Date: Tue, 22 Dec 2020 14:14:01 +0000 Subject: [PATCH] Update natives handling to handle architecture-specific native strings Fixes #2 --- .../launcher/model/minecraft/Library.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java b/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java index 7f49c7e..a5e0047 100644 --- a/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java +++ b/launcher/src/main/java/com/skcraft/launcher/model/minecraft/Library.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import com.skcraft.launcher.util.Environment; -import com.skcraft.launcher.util.Platform; import lombok.Data; import java.util.List; @@ -48,18 +47,25 @@ public class Library { return allow; } - public String getNativeString(Platform platform) { + public String getNativeString(Environment environment) { if (getNatives() != null) { - switch (platform) { + String nativeString; + + switch (environment.getPlatform()) { case LINUX: - return getNatives().get("linux"); + nativeString = getNatives().get("linux"); + break; case WINDOWS: - return getNatives().get("windows"); + nativeString = getNatives().get("windows"); + break; case MAC_OS_X: - return getNatives().get("osx"); + nativeString = getNatives().get("osx"); + break; default: return null; } + + return nativeString.replace("${arch}", environment.getArchBits()); } else { return null; } @@ -79,7 +85,7 @@ public class Library { setServerreq(true); // BACKWARDS COMPATIBILITY } - String nativeString = getNativeString(environment.getPlatform()); + String nativeString = getNativeString(environment); if (nativeString != null) { if (getDownloads().getClassifiers() == null) {