mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Merge pull request #10969 from Ultimaker/CURA-8666_dont_restore_backup_plugins
[CURA-8666] Don't restore files ignored with current backup policy.
This commit is contained in:
commit
748e698b57
1 changed files with 5 additions and 2 deletions
|
|
@ -181,8 +181,7 @@ class Backup:
|
||||||
|
|
||||||
return extracted
|
return extracted
|
||||||
|
|
||||||
@staticmethod
|
def _extractArchive(self, archive: "ZipFile", target_path: str) -> bool:
|
||||||
def _extractArchive(archive: "ZipFile", target_path: str) -> bool:
|
|
||||||
"""Extract the whole archive to the given target path.
|
"""Extract the whole archive to the given target path.
|
||||||
|
|
||||||
:param archive: The archive as ZipFile.
|
:param archive: The archive as ZipFile.
|
||||||
|
|
@ -201,7 +200,11 @@ class Backup:
|
||||||
Resources.factoryReset()
|
Resources.factoryReset()
|
||||||
Logger.log("d", "Extracting backup to location: %s", target_path)
|
Logger.log("d", "Extracting backup to location: %s", target_path)
|
||||||
name_list = archive.namelist()
|
name_list = archive.namelist()
|
||||||
|
ignore_string = re.compile("|".join(self.IGNORED_FILES + self.IGNORED_FOLDERS))
|
||||||
for archive_filename in name_list:
|
for archive_filename in name_list:
|
||||||
|
if ignore_string.search(archive_filename):
|
||||||
|
Logger.warning(f"File ({archive_filename}) in archive that doesn't fit current backup policy; ignored.")
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
archive.extract(archive_filename, target_path)
|
archive.extract(archive_filename, target_path)
|
||||||
except (PermissionError, EnvironmentError):
|
except (PermissionError, EnvironmentError):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue