1
This commit is contained in:
parent
71c377ccb9
commit
7efc8db744
20
hlna.py
20
hlna.py
@ -467,22 +467,14 @@ def modextract(id_mod, id_game_workshop):
|
|||||||
for dname in dirnames:
|
for dname in dirnames:
|
||||||
os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True)
|
os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True)
|
||||||
|
|
||||||
# for fname in filenames:
|
for fname in filenames:
|
||||||
# if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")):
|
if not os.path.isfile(os.path.join(dir_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")):
|
||||||
# os.unlink(os.path.join(modextractdir, fname))
|
os.unlink(os.path.join(dir_extract, fname))
|
||||||
|
|
||||||
for dname in dirnames:
|
for dname in dirnames:
|
||||||
if not os.path.isdir(os.path.join(dir_steam_workshop, dname)):
|
if not os.path.isdir(os.path.join(dir_steam_workshop, dname)):
|
||||||
shutil.rmtree(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)))
|
shutil.rmtree(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)))
|
||||||
|
|
||||||
# for root, dirs, files in os.walk(mod_steam_workshop):
|
|
||||||
# for name in files:
|
|
||||||
# if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")):
|
|
||||||
# srcfile = os.path.join(root, name)
|
|
||||||
# dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop))
|
|
||||||
# if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile):
|
|
||||||
# print_line(dstfile)
|
|
||||||
# shutil.copy2(srcfile, dstfile)
|
|
||||||
try:
|
try:
|
||||||
for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)):
|
for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)):
|
||||||
for file in files:
|
for file in files:
|
||||||
@ -504,11 +496,11 @@ def modextract(id_mod, id_game_workshop):
|
|||||||
modname = re.search(r'<div class="workshopItemTitle">(.+)</div>', modname)
|
modname = re.search(r'<div class="workshopItemTitle">(.+)</div>', modname)
|
||||||
modname = modname and modname.group(1)
|
modname = modname and modname.group(1)
|
||||||
|
|
||||||
if os.path.isfile("{}/.mod".format(dir_extract)):
|
if os.path.isfile(f"{dir_extract}/.mod"):
|
||||||
os.remove("{}/.mod".format(dir_extract))
|
os.remove(f"{dir_extract}/.mod")
|
||||||
|
|
||||||
modfile_bytes = b''
|
modfile_bytes = b''
|
||||||
with open(os.path.join(dir_extract, 'mod.info'), 'rb') as f:
|
with open(os.path.join(dir_steam_workshop, 'mod.info'), 'rb') as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
mapnamelen = struct.unpack_from('<L', data, offset=0)
|
mapnamelen = struct.unpack_from('<L', data, offset=0)
|
||||||
mapnamelen = mapnamelen[0]
|
mapnamelen = mapnamelen[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user