[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100433: Fix bug in copy-directory
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100433: Fix bug in copy-directory copying into an existing directory. |
Date: |
Sat, 29 Jan 2011 17:10:51 -0500 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100433
committer: Chong Yidong <address@hidden>
branch nick: emacs-23
timestamp: Sat 2011-01-29 17:10:51 -0500
message:
Fix bug in copy-directory copying into an existing directory.
http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg01007.html
* files.el (copy-directory): If destination is an existing
directory, copy into a subdirectory there.
modified:
lisp/ChangeLog
lisp/files.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-01-29 09:44:40 +0000
+++ b/lisp/ChangeLog 2011-01-29 22:10:51 +0000
@@ -1,3 +1,8 @@
+2011-01-29 Chong Yidong <address@hidden>
+
+ * files.el (copy-directory): If destination is an existing
+ directory, copy into a subdirectory there.
+
2011-01-29 Andreas Schwab <address@hidden>
* emacs-lisp/shadow.el (load-path-shadows-find): Ignore leim-list
=== modified file 'lisp/files.el'
--- a/lisp/files.el 2011-01-24 20:34:44 +0000
+++ b/lisp/files.el 2011-01-29 22:10:51 +0000
@@ -4756,7 +4756,22 @@
;; Compute target name.
(setq directory (directory-file-name (expand-file-name directory))
newname (directory-file-name (expand-file-name newname)))
- (if (not (file-directory-p newname)) (make-directory newname parents))
+
+ (if (not (file-directory-p newname))
+ ;; If NEWNAME is not an existing directory, create it; that
+ ;; is where we will copy the files of DIRECTORY.
+ (make-directory newname parents)
+ ;; If NEWNAME is an existing directory, we will copy into
+ ;; NEWNAME/[DIRECTORY-BASENAME].
+ (setq newname (expand-file-name
+ (file-name-nondirectory
+ (directory-file-name directory))
+ newname))
+ (if (and (file-exists-p newname)
+ (not (file-directory-p newname)))
+ (error "Cannot overwrite non-directory %s with a directory"
+ newname))
+ (make-directory newname t))
;; Copy recursively.
(mapc
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100433: Fix bug in copy-directory copying into an existing directory.,
Chong Yidong <=