summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Helm <nick@tenpoint.co.nz>2020-08-06 12:11:57 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-08-06 12:11:57 +0200
commit66bdf77adfa115ad16ec8557c250f0e5683262b0 (patch)
tree8633576f09f6398b3c8ea3f6f93417818daa27e1
parent361baa451adac7333e1037c3bc73bd95afa9b769 (diff)
downloademacs-66bdf77adfa115ad16ec8557c250f0e5683262b0.tar.gz
Signal an error in dired when moving to a directory that doesn't exist
* lisp/dired-aux.el (dired-do-create-files): Give an error when apparently moving to a directory name, and that directory doesn't exist (bug#38707).
-rw-r--r--lisp/dired-aux.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 777df79a6ef..6587d039b72 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1978,6 +1978,10 @@ Optional arg HOW-TO determines how to treat the target.
(apply (car into-dir) operation rfn-list fn-list target (cdr into-dir))
(if (not (or dired-one-file into-dir))
(error "Marked %s: target must be a directory: %s" operation target))
+ (if (and (not (file-directory-p (car fn-list)))
+ (not (file-directory-p target))
+ (directory-name-p target))
+ (error "%s: Target directory does not exist: %s" operation target))
;; rename-file bombs when moving directories unless we do this:
(or into-dir (setq target (directory-file-name target)))
(dired-create-files