Browse Source

Prevent crashes when backup fails to be restored

Also add a bit of logging so that we know what / how it went wrong
Jaime van Kessel 5 years ago
parent
commit
1c9eab6b2b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      cura/Backups/Backup.py

+ 5 - 1
cura/Backups/Backup.py

@@ -148,5 +148,9 @@ 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)
-        archive.extractall(target_path)
+        try:
+            archive.extractall(target_path)
+        except PermissionError:
+            Logger.logException("e", "Unable to extract the backup due to permission errors")
+            return False
         return True