1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Fix copying of symlinks.

* dired-aux.el (dired-copy-file-recursive, dired-create-files):
Check if file is a symlink (Bug#10489).

* files.el (copy-directory): Likewise.
This commit is contained in:
Thierry Volpiatto 2012-03-31 00:49:29 +08:00 committed by Chong Yidong
parent 5319014e4f
commit 40311efcba
4 changed files with 25 additions and 14 deletions

View file

@ -5102,13 +5102,14 @@ directly into NEWNAME instead."
;; We do not want to copy "." and "..".
(directory-files directory 'full
directory-files-no-dot-files-regexp))
(if (file-directory-p file)
(copy-directory file newname keep-time parents)
(let ((target (expand-file-name (file-name-nondirectory file) newname))
(attrs (file-attributes file)))
(if (stringp (car attrs)) ; Symbolic link
(make-symbolic-link (car attrs) target t)
(copy-file file target t keep-time)))))
(let ((target (expand-file-name (file-name-nondirectory file) newname))
(filetype (car (file-attributes file))))
(cond
((eq filetype t) ; Directory but not a symlink.
(copy-directory file newname keep-time parents))
((stringp filetype) ; Symbolic link
(make-symbolic-link filetype target t))
((copy-file file target t keep-time)))))
;; Set directory attributes.
(let ((modes (file-modes directory))