summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-09 02:06:31 +0200
committerhut <hut@lavabit.com>2010-04-09 02:06:31 +0200
commit5249464c9969a878ccb5d5b628fdd23ec1ef53e8 (patch)
tree57b73ac0ab73c832be6809c1cec80ac3db6c528c
parent7e48a475869781751d20606cf8b4115364fafe84 (diff)
downloadranger-5249464c9969a878ccb5d5b628fdd23ec1ef53e8.tar.gz
ext.shutil_generatorized: silently ignore permission exceptions
-rw-r--r--ranger/ext/shutil_generatorized.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/ranger/ext/shutil_generatorized.py b/ranger/ext/shutil_generatorized.py
index 8bf07ace..ca6be426 100644
--- a/ranger/ext/shutil_generatorized.py
+++ b/ranger/ext/shutil_generatorized.py
@@ -83,18 +83,22 @@ def copymode(src, dst):
     if hasattr(os, 'chmod'):
         st = os.stat(src)
         mode = stat.S_IMODE(st.st_mode)
-        os.chmod(dst, mode)
+        try: os.chmod(dst, mode)
+        except: pass
 
 def copystat(src, dst):
     """Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
     st = os.stat(src)
     mode = stat.S_IMODE(st.st_mode)
     if hasattr(os, 'utime'):
-        os.utime(dst, (st.st_atime, st.st_mtime))
+        try: os.utime(dst, (st.st_atime, st.st_mtime))
+        except: pass
     if hasattr(os, 'chmod'):
-        os.chmod(dst, mode)
+        try: os.chmod(dst, mode)
+        except: pass
     if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
-        os.chflags(dst, st.st_flags)
+        try: os.chflags(dst, st.st_flags)
+        except: pass
 
 
 def copy(src, dst, overwrite=False):