Make sure only OS-specific natives are extracted

This commit is contained in:
Fierelier 2021-06-16 15:41:19 +02:00
parent 8246e600c0
commit 3668c90ab6

View File

@ -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