diff options
author | hut <hut@lepus.uberspace.de> | 2015-02-06 20:42:38 +0100 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2015-02-06 23:30:49 +0100 |
commit | 9495f9779c0604996cead68f2e083dbea4928b3c (patch) | |
tree | b593de84c116eb6e402af49cdc77358eaab2ee95 | |
parent | 1bb7f23f5474d7fa3ca535607e437d0622698de7 (diff) | |
download | ranger-9495f9779c0604996cead68f2e083dbea4928b3c.tar.gz |
ext.shutil_generatorized: fixed #143 (copying of links)
This bug was introduced in a986e2bd...
-rw-r--r-- | ranger/ext/shutil_generatorized.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ranger/ext/shutil_generatorized.py b/ranger/ext/shutil_generatorized.py index 38e506a2..2df04926 100644 --- a/ranger/ext/shutil_generatorized.py +++ b/ranger/ext/shutil_generatorized.py @@ -103,6 +103,8 @@ def copy2(src, dst, overwrite=False, symlinks=False): dst = get_safe_path(dst) if symlinks and os.path.islink(src): linkto = os.readlink(src) + if overwrite and os.path.lexists(dst): + os.unlink(dst) os.symlink(linkto, dst) else: for _ in copyfile(src, dst): @@ -171,11 +173,10 @@ def copytree(src, dst, symlinks=False, ignore=None, overwrite=False): try: if symlinks and os.path.islink(srcname): linkto = os.readlink(srcname) - if os.path.lexists(dstname): - if not os.path.islink(dstname) \ - or os.readlink(dstname) != linkto: - os.unlink(dstname) - os.symlink(linkto, dstname) + if overwrite and os.path.lexists(dstname): + os.unlink(dstname) + os.symlink(linkto, dstname) + copystat(srcname, dstname) elif os.path.isdir(srcname): for _ in copytree(srcname, dstname, symlinks, ignore, overwrite): |