Compatibility with packing read-only source files
File permissions are no longer copied when packing. This means that read-only source files can still be packed without errors, even when they have to be rewritten (due to changed paths). Reviewed by: sybren Differential Revision: https://developer.blender.org/D13128
This commit is contained in:
committed by
Sybren A. Stüvel
parent
2843cce6fd
commit
608a7bdac9
@@ -206,7 +206,8 @@ class BlendFile:
|
||||
|
||||
self.log.debug("Copying %s to %s", self.filepath, path)
|
||||
# TODO(Sybren): remove str() calls when targeting Python 3.6+
|
||||
shutil.copy(str(self.filepath), str(path))
|
||||
# dst needs to be a file and not a directory
|
||||
shutil.copyfile(str(self.filepath), str(path))
|
||||
|
||||
self.fileobj = self._open_file(path, mode=mode)
|
||||
_cache(path, self)
|
||||
|
||||
@@ -152,12 +152,12 @@ class FileCopier(transfer.FileTransferer):
|
||||
return True
|
||||
|
||||
def _move(self, srcpath: pathlib.Path, dstpath: pathlib.Path):
|
||||
"""Low-level file move"""
|
||||
"""Low-level file move."""
|
||||
shutil.move(str(srcpath), str(dstpath))
|
||||
|
||||
def _copy(self, srcpath: pathlib.Path, dstpath: pathlib.Path):
|
||||
"""Low-level file copy"""
|
||||
shutil.copy2(str(srcpath), str(dstpath))
|
||||
"""Low-level file copy. dstpath needs to be a file and not a directory."""
|
||||
shutil.copyfile(str(srcpath), str(dstpath))
|
||||
|
||||
def move(self, srcpath: pathlib.Path, dstpath: pathlib.Path):
|
||||
s_stat = srcpath.stat()
|
||||
|
||||
Reference in New Issue
Block a user