mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 03:37:48 -06:00
CURA-4934 fix crash handler cleanup in some rare case
This commit is contained in:
parent
f29d07ce40
commit
8bb70d6cc2
1 changed files with 8 additions and 5 deletions
|
@ -162,12 +162,15 @@ class CrashHandler:
|
||||||
file_name = base_name + "_" + date_now + "_" + idx
|
file_name = base_name + "_" + date_now + "_" + idx
|
||||||
zip_file_path = os.path.join(root_dir, file_name + ".zip")
|
zip_file_path = os.path.join(root_dir, file_name + ".zip")
|
||||||
try:
|
try:
|
||||||
# remove the .zip extension because make_archive() adds it
|
# only create the zip backup when the folder exists
|
||||||
zip_file_path = zip_file_path[:-4]
|
if os.path.exists(folder):
|
||||||
shutil.make_archive(zip_file_path, "zip", root_dir = root_dir, base_dir = base_name)
|
# remove the .zip extension because make_archive() adds it
|
||||||
|
zip_file_path = zip_file_path[:-4]
|
||||||
|
shutil.make_archive(zip_file_path, "zip", root_dir = root_dir, base_dir = base_name)
|
||||||
|
|
||||||
|
# remove the folder only when the backup is successful
|
||||||
|
shutil.rmtree(folder, ignore_errors = True)
|
||||||
|
|
||||||
# remove the folder only when the backup is successful
|
|
||||||
shutil.rmtree(folder, ignore_errors = True)
|
|
||||||
# create an empty folder so Resources will not try to copy the old ones
|
# create an empty folder so Resources will not try to copy the old ones
|
||||||
os.makedirs(folder, 0o0755, exist_ok=True)
|
os.makedirs(folder, 0o0755, exist_ok=True)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue