Mercurial > emacs
comparison lisp/files.el @ 108324:297d4e80151f
* files.el (copy-directory): Handle symlinks (Bug#5982).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 20 Apr 2010 18:28:26 -0400 |
parents | 64f6b7b30092 |
children | 973b5bc5fcfe 3a80fc3735bf |
comparison
equal
deleted
inserted
replaced
108323:bdf81babd7c5 | 108324:297d4e80151f |
---|---|
4733 | 4733 |
4734 ;; Copy recursively. | 4734 ;; Copy recursively. |
4735 (mapc | 4735 (mapc |
4736 (lambda (file) | 4736 (lambda (file) |
4737 (let ((target (expand-file-name | 4737 (let ((target (expand-file-name |
4738 (file-name-nondirectory file) newname))) | 4738 (file-name-nondirectory file) newname)) |
4739 (if (file-directory-p file) | 4739 (attrs (file-attributes file))) |
4740 (copy-directory file target keep-time parents) | 4740 (cond ((file-directory-p file) |
4741 (copy-file file target t keep-time)))) | 4741 (copy-directory file target keep-time parents)) |
4742 ((stringp (car attrs)) ; Symbolic link | |
4743 (make-symbolic-link (car attrs) target t)) | |
4744 (t | |
4745 (copy-file file target t keep-time))))) | |
4742 ;; We do not want to copy "." and "..". | 4746 ;; We do not want to copy "." and "..". |
4743 (directory-files directory 'full directory-files-no-dot-files-regexp)) | 4747 (directory-files directory 'full directory-files-no-dot-files-regexp)) |
4744 | 4748 |
4745 ;; Set directory attributes. | 4749 ;; Set directory attributes. |
4746 (set-file-modes newname (file-modes directory)) | 4750 (set-file-modes newname (file-modes directory)) |