1
0
mirror of https://github.com/Escartem/AnimeWwise.git synced 2026-06-04 23:40:25 +08:00

new path export argument

This commit is contained in:
Escartem
2023-11-24 15:05:29 +01:00
parent 0dc9505fc0
commit 81e59587a3

View File

@@ -125,7 +125,7 @@ def detect_bank_version(offset):
reader.SetBufferPos(current)
def extract_sector(section_size, is_sounds, is_externals, ext, endianness, lang_array, bank_version, output_folder, filter_bnk_only=0, filter_wem_only=0):
def extract_sector(section_size, is_sounds, is_externals, ext, endianness, lang_array, bank_version, output_folder, filter_bnk_only=0, filter_wem_only=0, include_name=False):
# check sector validity
if section_size == 0:
return
@@ -217,9 +217,15 @@ def extract_sector(section_size, is_sounds, is_externals, ext, endianness, lang_
reader.SetBufferPos(offset)
file_data = reader.ReadBytes(size)
os.makedirs(output_folder, exist_ok=True)
if include_name:
file_path = os.path.join(output_folder, os.path.dirname(name))
else:
file_path = output_folder
name = os.path.basename(name)
with open(os.path.join(output_folder, os.path.basename(name)), "wb+") as f:
os.makedirs(file_path, exist_ok=True)
with open(os.path.join(file_path, name), "wb+") as f:
f.write(file_data)
f.close()