41 lines
937 B
Python
41 lines
937 B
Python
|
#!/usr/bin/env python3
|
||
|
import sys
|
||
|
|
||
|
oldexcepthook = sys.excepthook
|
||
|
def newexcepthook(type,value,traceback):
|
||
|
oldexcepthook(type,value,traceback)
|
||
|
input("Press ENTER to quit.")
|
||
|
sys.excepthook = newexcepthook
|
||
|
|
||
|
import os
|
||
|
import shutil
|
||
|
p = os.path.join
|
||
|
pUp = os.path.dirname
|
||
|
s = False
|
||
|
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||
|
s = os.path.realpath(sys.executable)
|
||
|
else:
|
||
|
s = os.path.realpath(__file__)
|
||
|
sp = pUp(s)
|
||
|
|
||
|
import json
|
||
|
|
||
|
def main():
|
||
|
assetJson = {}
|
||
|
with open(p("assets","indexes","pre-1.6.json"),"r") as jsonFile:
|
||
|
assetJson = json.loads(jsonFile.read())
|
||
|
|
||
|
for asset in assetJson["objects"]:
|
||
|
hash = assetJson["objects"][asset]["hash"]
|
||
|
infile = p("assets","objects",hash[:2],hash)
|
||
|
outfile = p("resources",asset)
|
||
|
outfolder = pUp(outfile)
|
||
|
|
||
|
if not os.path.isdir(outfolder):
|
||
|
os.makedirs(outfolder)
|
||
|
|
||
|
if not os.path.isfile(outfile):
|
||
|
print(asset+ " ...")
|
||
|
shutil.copyfile(infile,outfile)
|
||
|
|
||
|
main()
|