offline-minecraft-launcher/oml/stages/natives-extract.py
2022-05-13 15:36:37 +02:00

19 lines
960 B
Python

print(colored(colorama.Fore.GREEN,"\nExtracting natives..."))
if not os.path.isdir(nativesOutPath): os.makedirs(nativesOutPath)
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(colored(colorama.Fore.RED,"> Native not found: ") +getLibraryPrettyName(library),file=sys.stderr)
continue
print(colored(colorama.Fore.BLACK,getLibraryPrettyName(library)))
proc = subprocess.Popen(["7z","x",library["filePathOS"],"-o" +nativesOutPath,"-aos"],stdout=subprocess.DEVNULL)
rtn = proc.wait()
if rtn != 0:
print(colored(colorama.Fore.RED,"> Native could not be extracted: ") +getLibraryPrettyName(library),file=sys.stderr)