mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 19:39:03 +08:00
For now just ignore locked files on windows
This commit is contained in:
parent
f00459e4cc
commit
8b0346e11b
@ -138,8 +138,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.
|
||||||
@ -148,7 +147,7 @@ class Backup:
|
|||||||
"""
|
"""
|
||||||
Logger.log("d", "Removing current data in location: %s", target_path)
|
Logger.log("d", "Removing current data in location: %s", target_path)
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(target_path)
|
shutil.rmtree(target_path, ignore_errors=True, onerror=self._handleRemovalError)
|
||||||
except PermissionError as error:
|
except PermissionError as error:
|
||||||
# This happens if a file is already opened by another program, usually only the log file.
|
# This happens if a file is already opened by another program, usually only the log file.
|
||||||
# For now we just ignore this as it doesn't harm the restore process.
|
# For now we just ignore this as it doesn't harm the restore process.
|
||||||
@ -157,3 +156,8 @@ class Backup:
|
|||||||
Logger.log("d", "Extracting backup to location: %s", target_path)
|
Logger.log("d", "Extracting backup to location: %s", target_path)
|
||||||
archive.extractall(target_path)
|
archive.extractall(target_path)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _handleRemovalError(*args):
|
||||||
|
func, path, _ = args
|
||||||
|
Logger.log("w", "Could not remove path %s when doing recursive delete, ignoring...", path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user