From 81e59587a3401f8cd0326194e8994524cc355d13 Mon Sep 17 00:00:00 2001 From: Escartem Date: Fri, 24 Nov 2023 15:05:29 +0100 Subject: [PATCH] new path export argument --- wavescan.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wavescan.py b/wavescan.py index 64875cd..da643e9 100644 --- a/wavescan.py +++ b/wavescan.py @@ -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()