diff options
author | Diego Prado Gesto <d.pradogesto@ultimaker.com> | 2018-02-05 13:17:17 +0300 |
---|---|---|
committer | Diego Prado Gesto <d.pradogesto@ultimaker.com> | 2018-02-05 13:28:17 +0300 |
commit | 383319d631c644d29c9b7a1e98ad1ed3b574f48c (patch) | |
tree | 9baca336bff2f28c30530dbbdd51b4d4ce995b59 /cura/CrashHandler.py | |
parent | 915bb2e450ad2a710c4cdb6815c663904dbb91f5 (diff) |
CURA-4895 Correctly format the date for the backup file
Diffstat (limited to 'cura/CrashHandler.py')
-rw-r--r-- | cura/CrashHandler.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index e5975b9b2b..e90619aee5 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -144,23 +144,20 @@ class CrashHandler: if cache_path not in (config_path, data_path): folders_to_remove.append(cache_path) - # need to close the redirected stdout and stderr files, otherwise, on Windows, those opened files will prevent - # the directory removal calls below. - sys.stdout.close() - sys.stderr.close() - for folder in folders_to_remove: shutil.rmtree(folder, ignore_errors = True) for folder in folders_to_backup: base_name = os.path.basename(folder) root_dir = os.path.dirname(folder) + import datetime + date_now = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") idx = 0 - file_name = base_name + "_" + str(time.time()) + file_name = base_name + "_" + date_now zip_file_path = os.path.join(root_dir, file_name + ".zip") while os.path.exists(zip_file_path): idx += 1 - file_name = base_name + "_" + str(time.time()) + "_" + idx + file_name = base_name + "_" + date_now + "_" + idx zip_file_path = os.path.join(root_dir, file_name + ".zip") try: # remove the .zip extension because make_archive() adds it |