summaryrefslogtreecommitdiff
path: root/extract_assets.py
diff options
context:
space:
mode:
authorJeffrey Crowell <github@crowell.biz>2022-07-21 19:12:43 -0400
committerKenix3 <kenixwhisperwind@gmail.com>2022-07-25 19:06:05 -0400
commit271cec1f9e3c37a2b8cc822277f274c5b099a4ce (patch)
treefb36dfb896a85e31ed1f7df40b5920cf1b53c887 /extract_assets.py
parent4d985cd534a3e691bf6c2233902be5708c1d19df (diff)
allow roms with spaces to be extracted (#868)
using subprocess instead of os.system() is a little safer, and allows for roms with spaces to be extraced. i've noticed this is somewhat common in people reporting issues on discord.
Diffstat (limited to 'extract_assets.py')
-rwxr-xr-xextract_assets.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/extract_assets.py b/extract_assets.py
index 6862fb0..407760b 100755
--- a/extract_assets.py
+++ b/extract_assets.py
@@ -5,6 +5,7 @@ import shutil
from rom_info import Z64Rom
import rom_chooser
import struct
+import subprocess
def BuildOTR(xmlPath, rom):
shutil.copytree("assets", "Extract/assets")
@@ -13,11 +14,13 @@ def BuildOTR(xmlPath, rom):
with open("Extract/version", "wb") as f:
f.write(struct.pack('<L', checksum))
- execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPDTR/ZAPD.out"
- execStr += " ed -i %s -b %s -fl CFG/filelists -o placeholder -osf placeholder -gsf 1 -rconf CFG/Config.xml -se OTR" % (xmlPath, rom)
+ zapd_exe = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPDTR/ZAPD.out"
+ exec_cmd = [zapd_exe, "ed", "-i", xmlPath, "-b", rom, "-fl", "CFG/filelists",
+ "-o", "placeholder", "-osf", "placeholder", "-gsf", "1",
+ "-rconf", "CFG/Config.xml", "-se", "OTR"]
- print(execStr)
- exitValue = os.system(execStr)
+ print(exec_cmd)
+ exitValue = subprocess.call(exec_cmd)
if exitValue != 0:
print("\n")
print("Error when building the OTR file...", file=os.sys.stderr)