removed temporary directory that were used with previous wszst subprocess call with cwd in the game path

This commit is contained in:
raphael60650 2021-07-27 20:54:10 +02:00
parent ebca6c3335
commit 1bb84fce32
2 changed files with 4 additions and 11 deletions

View file

@ -234,10 +234,7 @@ class Game:
:param auto_add_dir: autoadd directory
"""
if os.path.exists(auto_add_dir): shutil.rmtree(auto_add_dir)
if not os.path.exists(self.path + "/tmp/"): os.makedirs(self.path + "/tmp/")
wszst.szs.autoadd(self.path, get_nodir(self.path) + "/tmp/auto-add/")
shutil.move(self.path + "/tmp/auto-add/", auto_add_dir)
shutil.rmtree(self.path + "/tmp/")
wszst.szs.autoadd(self.path, auto_add_dir)
def patch_bmg(self, gamefile: str) -> None:
"""
@ -303,16 +300,12 @@ class Game:
f.write(f" {track_id}\t= {prefix}{track_name}\n")
if not os.path.exists("./file/tmp/"): os.makedirs("./file/tmp/")
shutil.copyfile(gamefile + ".d/message/Common.bmg", "./file/tmp/Common.bmg")
bmgcommon = wszst.ctc.patch_bmg(ctfile="./file/CTFILE.txt",
bmgs=["./file/tmp/Common.bmg", "./file/ExtraCommon.txt"])
bmgs=[gamefile + ".d/message/Common.bmg", "./file/ExtraCommon.txt"])
rbmgcommon = wszst.ctc.patch_bmg(ctfile="./file/RCTFILE.txt",
bmgs=["./file/tmp/Common.bmg", "./file/ExtraCommon.txt"])
bmgs=[gamefile + ".d/message/Common.bmg", "./file/ExtraCommon.txt"])
shutil.rmtree(gamefile + ".d")
os.remove("./file/tmp/Common.bmg")
os.remove("./file/ExtraCommon.txt")
def finalise(file, bmgtext, replacement_list=None):

View file

@ -1,7 +1,7 @@
from . import *
def szs_extract(file: str, dest_dir: str) -> None:
def extract(file: str, dest_dir: str) -> None:
"""
Extract an szs in a directory
:param file: .szs file