summaryrefslogtreecommitdiff
path: root/lisp/dired-aux.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2000-08-08 10:51:51 +0000
committerEli Zaretskii <eliz@gnu.org>2000-08-08 10:51:51 +0000
commit325fec3c5a7770f3bac3a481b11b58811a87ccb0 (patch)
treef56c120726a5fa4ca5113d1335ba23effcc5ecc9 /lisp/dired-aux.el
parent0a6b8ff7302fc17e11656cc85cac90c77cc81645 (diff)
downloademacs-325fec3c5a7770f3bac3a481b11b58811a87ccb0.tar.gz
(dired-do-create-files): On DOS/Windows, allow to
rename a directory to a name that differs only by its letter case.
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r--lisp/dired-aux.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 8ff4128350d..4a2d8932457 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1232,7 +1232,25 @@ ESC or `q' to not overwrite any of the remaining files,
(concat (if dired-one-file op1 operation) " %s to: ")
(dired-dwim-target-directory)
op-symbol arg rfn-list)))
- (into-dir (cond ((null how-to) (file-directory-p target))
+ (into-dir (cond ((null how-to)
+ ;; Allow DOS/Windows users to change the letter
+ ;; case of a directory. If we don't test these
+ ;; conditions up front, file-directory-p below
+ ;; will return t because the filesystem is
+ ;; case-insensitive, and Emacs will try to move
+ ;; foo -> foo/foo, which fails.
+ (if (and (memq system-type '(ms-dos windows-nt))
+ (eq op-symbol 'move)
+ dired-one-file
+ (string= (downcase
+ (expand-file-name (car fn-list)))
+ (downcase
+ (expand-file-name target)))
+ (not (string=
+ (file-name-nondirectory (car fn-list))
+ (file-name-nondirectory target))))
+ nil
+ (file-directory-p target)))
((eq how-to t) nil)
(t (funcall how-to target)))))
(if (and (consp into-dir) (functionp (car into-dir)))