From 3668c90ab6dd6e1cb7a7fe5b18c95b4df36a6c71 Mon Sep 17 00:00:00 2001 From: Fierelier Date: Wed, 16 Jun 2021 15:41:19 +0200 Subject: [PATCH] Make sure only OS-specific natives are extracted --- offline-minecraft-launcher.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/offline-minecraft-launcher.py b/offline-minecraft-launcher.py index 22e65f2..77d4d06 100644 --- a/offline-minecraft-launcher.py +++ b/offline-minecraft-launcher.py @@ -184,6 +184,7 @@ def processVersion(versionsPath,libraryPath,nativePath,version): if not l["dumb"]: for classifier in library["downloads"]["classifiers"]: native = library["downloads"]["classifiers"][classifier] + l["nativeOS"] = classifier.replace("natives-","",1) l["filePathOS"] = p(nativePath,native["path"].replace("/",os.path.sep)) if "url" in native and native["url"] != "": l["url"] = native["url"] @@ -196,8 +197,9 @@ def processVersion(versionsPath,libraryPath,nativePath,version): lcopy = l.copy() for native in library["natives"]: - native = "natives-" + native l = lcopy.copy() + l["nativeOS"] = native + native = "natives-" + native l["filePath"] = l["filePath"][:-4] + "-" + native + ".jar" l["url"] = l["url"][:-4] + "-" + native + ".jar" l["filePathOS"] = p(nativePath,l["filePath"].replace("/",os.path.sep)) @@ -338,6 +340,11 @@ def main(): for library in libraries: if library["type"] == "native": if "rules" in library["data"] and checkRules(library["data"]["rules"]) == "disallow": continue + if lv["osName"] != "macos": + if library["nativeOS"] != lv["osName"]: continue + else: + if not library["nativeOS"] in ["macos","osx"]: continue + if not os.path.isfile(library["filePathOS"]): print("Native not found: " +library["path"]+ ":" +library["version"]) continue