Commit 9bd05e3b by rfkelly0

Wrap use of shutil.copyfile() in convet_os_errors() decorator, for cleaner error reporting

parent 38e0f457
...@@ -497,7 +497,7 @@ class FS(object): ...@@ -497,7 +497,7 @@ class FS(object):
dst_syspath = self.getsyspath(dst, allow_none=True) dst_syspath = self.getsyspath(dst, allow_none=True)
if src_syspath is not None and dst_syspath is not None: if src_syspath is not None and dst_syspath is not None:
shutil.copyfile(src_syspath, dst_syspath) self._shutil_copyfile(src_syspath, dst_syspath)
else: else:
src_file, dst_file = None, None src_file, dst_file = None, None
try: try:
...@@ -515,6 +515,9 @@ class FS(object): ...@@ -515,6 +515,9 @@ class FS(object):
if dst_file is not None: if dst_file is not None:
dst_file.close() dst_file.close()
@convert_os_errors
def _shutil_copyfile(self,src_syspath,dst_syspath):
shutil.copyfile(src_syspath,dst_syspath)
def move(self, src, dst, overwrite=False, chunk_size=16384): def move(self, src, dst, overwrite=False, chunk_size=16384):
"""Moves a file from one location to another. """Moves a file from one location to another.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment