diff options
author | hut <hut@lavabit.com> | 2010-04-09 02:06:31 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-09 02:06:31 +0200 |
commit | 5249464c9969a878ccb5d5b628fdd23ec1ef53e8 (patch) | |
tree | 57b73ac0ab73c832be6809c1cec80ac3db6c528c /ranger | |
parent | 7e48a475869781751d20606cf8b4115364fafe84 (diff) | |
download | ranger-5249464c9969a878ccb5d5b628fdd23ec1ef53e8.tar.gz |
ext.shutil_generatorized: silently ignore permission exceptions
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/shutil_generatorized.py | 12 |
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): |