mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03:56 -06:00
revert
This commit is contained in:
parent
fb40ea13cc
commit
f00459e4cc
1 changed files with 3 additions and 9 deletions
|
@ -138,7 +138,8 @@ class Backup:
|
|||
|
||||
return extracted
|
||||
|
||||
def _extractArchive(self, archive: "ZipFile", target_path: str) -> bool:
|
||||
@staticmethod
|
||||
def _extractArchive(archive: "ZipFile", target_path: str) -> bool:
|
||||
"""
|
||||
Extract the whole archive to the given target path.
|
||||
:param archive: The archive as ZipFile.
|
||||
|
@ -147,7 +148,7 @@ class Backup:
|
|||
"""
|
||||
Logger.log("d", "Removing current data in location: %s", target_path)
|
||||
try:
|
||||
shutil.rmtree(target_path, onerror=self._onRemoveError)
|
||||
shutil.rmtree(target_path)
|
||||
except PermissionError as error:
|
||||
# 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.
|
||||
|
@ -156,10 +157,3 @@ class Backup:
|
|||
Logger.log("d", "Extracting backup to location: %s", target_path)
|
||||
archive.extractall(target_path)
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def _onRemoveError(*args):
|
||||
import stat # needed for file stat
|
||||
func, path, _ = args # onerror returns a tuple containing function, path and exception info
|
||||
os.chmod(path, stat.S_IWRITE)
|
||||
os.remove(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue