Skip to content

Commit dd59687

Browse files
committed
deleting all files when exception shows up
1 parent 4fda196 commit dd59687

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

FT_Builder.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,11 @@ def main():
265265

266266
#creates the FBXDiffFile
267267
if subprocess.run([hdiffz, '-f', OriginalFBX, FaceTrackedFBX, FBXDiffFile]).returncode != 0:
268-
print("Error occurred during creation of the diff file.")
269-
input("Press Enter to continue...")
268+
raise Exception("Error occurred during creation of the diff file.")
270269

271270
#creates the MetaFBXDiffFile
272271
if subprocess.run([hdiffz, '-f', OriginalFBX+".meta", FaceTrackedFBX+".meta", MetaDiffFile]).returncode != 0:
273-
print("Error occurred during creation of the meta diff file.")
274-
input("Press Enter to continue...")
272+
raise Exception("Error occurred during creation of the meta diff file.")
275273

276274
#location of the og script and the destination script
277275
OriginalScript = os.path.abspath(os.path.join(__file__, '..', 'PythonPatcher.py'))
@@ -359,9 +357,27 @@ def main():
359357

360358

361359
print_ascii_Ready()
360+
361+
362+
363+
364+
362365
except Exception as e:
363366
CustomDir = os.path.abspath(os.path.join(os.path.dirname(__file__), NameCustomDir))
364-
delete_files_in_directory(CustomDir)
367+
if os.path.isfile(CustomDir):
368+
delete_files_in_directory(CustomDir)
369+
370+
BuildFolder = os.path.abspath(os.path.join(os.path.dirname(__file__), 'build'))
371+
if os.path.exists(BuildFolder):
372+
delete_files_in_directory(BuildFolder)
373+
374+
if os.path.isfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "! " + NameCustomAvatarDir + "Patcher.py"))):
375+
os.remove(os.path.abspath(os.path.join(os.path.dirname(__file__), "! " + NameCustomAvatarDir + "Patcher.py")))
376+
377+
if os.path.isfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "! " + NameCustomAvatarDir + "Patcher.spec"))):
378+
os.remove(os.path.abspath(os.path.join(os.path.dirname(__file__), "! " + NameCustomAvatarDir + "Patcher.spec")))
379+
380+
365381
print("An error occurred while copying the file:", str(e))
366382

367383

0 commit comments

Comments
 (0)