Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantinos Karmas <konskarm@gmail.com>2021-06-24 18:26:57 +0300
committerKonstantinos Karmas <konskarm@gmail.com>2021-06-24 18:26:57 +0300
commit4fe199ccc7933f437e503212a25dfb08118a4476 (patch)
tree0665f2e65fe1a8408e0e60b9259af1487fadfdd4 /cura/Backups
parent4d29de45796dc42f76c774a216a0601bb57cf790 (diff)
Ignore files-in-use while restoring a backup
Sometimes, while a backup is being restore, one of the files in the current config folder may be still in use. This means that once the backup tries to replace this file with the one in the backup, the entire backup restoration fails and half the configuration folder has been messed up. To prevent that, we decided to ignore files that are currently in use while restoring a backup. This _may_ lead to a slightly wrong configuration (e.g. a plugin may not be restored properly), but it is an acceptable result, as the rest of the configuration folder is restored properly. CURA-8313
Diffstat (limited to 'cura/Backups')
-rw-r--r--cura/Backups/Backup.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py
index 6128dac320..1f6a961733 100644
--- a/cura/Backups/Backup.py
+++ b/cura/Backups/Backup.py
@@ -193,14 +193,13 @@ class Backup:
Logger.log("d", "Removing current data in location: %s", target_path)
Resources.factoryReset()
Logger.log("d", "Extracting backup to location: %s", target_path)
- try:
- name_list = archive.namelist()
- for archive_filename in name_list:
+ name_list = archive.namelist()
+ for archive_filename in name_list:
+ try:
archive.extract(archive_filename, target_path)
- CuraApplication.getInstance().processEvents()
- except (PermissionError, EnvironmentError):
- Logger.logException("e", "Unable to extract the backup due to permission or file system errors.")
- return False
+ except (PermissionError, EnvironmentError):
+ Logger.logException("e", f"Unable to extract the file {archive_filename} from the backup due to permission or file system errors.")
+ CuraApplication.getInstance().processEvents()
return True
def _obfuscate(self) -> Dict[str, str]: