about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--ranger/core/loader.py2
-rw-r--r--ranger/ext/shutil_generatorized.py13
3 files changed, 10 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 6c31bb0f..1ed19c64 100644
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@ doc: cleandoc
 		$(PYTHON) -c 'import pydoc, sys; \
 		sys.path[0] = "$(CWD)"; \
 		pydoc.writedocs("$(CWD)")'
-	find . -name \*.html -exec sed -i 's|'$(CWD)'|../..|g' -- {} \;
+	find . -name \*.html -exec sed -i 's|'"$(CWD)"'|../..|g' -- {} \;
 
 test:
 	@for FILE in $(shell grep -IHm 1 doctest -r ranger | grep $(FILTER) | cut -d: -f1); do \
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 17d6bf09..3ba5b128 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -59,6 +59,8 @@ class CopyLoader(Loadable, FileManagerAware):
         stack = [f.path for f in self.copy_buffer]
         while stack:
             fname = stack.pop()
+            if os.path.islink(fname):
+                continue
             if os.path.isdir(fname):
                 stack.extend([join(fname, item) for item in os.listdir(fname)])
             else:
diff --git a/ranger/ext/shutil_generatorized.py b/ranger/ext/shutil_generatorized.py
index 38e506a2..b20d5cef 100644
--- a/ranger/ext/shutil_generatorized.py
+++ b/ranger/ext/shutil_generatorized.py
@@ -79,7 +79,7 @@ def copyfile(src, dst):
 
 def copystat(src, dst):
     """Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
-    st = os.stat(src)
+    st = os.lstat(src)
     mode = stat.S_IMODE(st.st_mode)
     if hasattr(os, 'utime'):
         try: os.utime(dst, (st.st_atime, st.st_mtime))
@@ -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):