mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 10:52:19 -05:00
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.
This commit is contained in:
parent
87ed5fedfd
commit
b6af684583
@ -5,6 +5,7 @@ import shutil
|
|||||||
from rom_info import Z64Rom
|
from rom_info import Z64Rom
|
||||||
import rom_chooser
|
import rom_chooser
|
||||||
import struct
|
import struct
|
||||||
|
import subprocess
|
||||||
|
|
||||||
def BuildOTR(xmlPath, rom):
|
def BuildOTR(xmlPath, rom):
|
||||||
shutil.copytree("assets", "Extract/assets")
|
shutil.copytree("assets", "Extract/assets")
|
||||||
@ -13,11 +14,13 @@ def BuildOTR(xmlPath, rom):
|
|||||||
with open("Extract/version", "wb") as f:
|
with open("Extract/version", "wb") as f:
|
||||||
f.write(struct.pack('<L', checksum))
|
f.write(struct.pack('<L', checksum))
|
||||||
|
|
||||||
execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPDTR/ZAPD.out"
|
zapd_exe = "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)
|
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)
|
print(exec_cmd)
|
||||||
exitValue = os.system(execStr)
|
exitValue = subprocess.call(exec_cmd)
|
||||||
if exitValue != 0:
|
if exitValue != 0:
|
||||||
print("\n")
|
print("\n")
|
||||||
print("Error when building the OTR file...", file=os.sys.stderr)
|
print("Error when building the OTR file...", file=os.sys.stderr)
|
||||||
|
Loading…
Reference in New Issue
Block a user