From 5a669ae0cf47d3ca1159e9dec934a5b07249e244 Mon Sep 17 00:00:00 2001 From: Fierelier Date: Fri, 27 Dec 2019 15:28:49 +0100 Subject: [PATCH] added rough opus.temp.remove --- scripts/api/main.py | 13 ++++++++++++- scripts/main.py | 11 +++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/api/main.py b/scripts/api/main.py index 53668fe..a517dfc 100644 --- a/scripts/api/main.py +++ b/scripts/api/main.py @@ -18,4 +18,15 @@ def _mainExecPy(_scriptPath): opus.main.output("done.",2) return _return -opus.script.execute = _mainExecPy \ No newline at end of file +opus.script.execute = _mainExecPy + +opus.temp = Munch() +def _tempRemove(): + if os.path.isdir(opus.path.temp): + opus.main.output("clearing temp directory...",1) + try: + opus.reg.unmount() + except: + pass + rtn = subprocess.call(["rmdir","/s","/q",opus.path.temp],shell=True) +opus.temp.remove = _tempRemove \ No newline at end of file diff --git a/scripts/main.py b/scripts/main.py index e0c4561..4505d41 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -57,13 +57,7 @@ opus.script.execute(pJoin(opus.path.main,"scripts","path.py")) opus.main.output("",1) -if os.path.isdir(opus.path.temp): - opus.main.output("clearing temp directory...",1) - try: - opus.reg.unmount() - except: - pass - shutil.rmtree(opus.path.temp) +opus.temp.remove() os.makedirs(pJoin(opus.path.temp,"wim")) opus.wim.location = pJoin(opus.path.target,"sources","install.wim") @@ -90,4 +84,5 @@ for tag in opus.os.tags: opus.main.output("\nif you'd like to make manual changes, please do so now. press enter to finalize or ctrl+c to cancel.") input() -opus.wim.update() \ No newline at end of file +opus.wim.update() +opus.temp.remove() \ No newline at end of file