branch: elpa/helm
commit ff43aedfe0391221459f1f8c54db8e6a443ae7f6
Author: Thierry Volpiatto <thie...@posteo.net>
Commit: Thierry Volpiatto <thie...@posteo.net>

    Do not delegate directories creation to dired
    
    with dired-create-destination-dirs when copying/renaming/symlinking
    etc... files.
    
    This because dired fails to create dirs when creating symlinks in a
    non existent directory.
    
    This is what we were doing before dired-create-destination-dirs
    existence.
---
 helm-files.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index a750176653..b7b9c04693 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -1206,7 +1206,8 @@ ACTION can be `rsync' or any action supported by 
`helm-dired-action'."
   (require 'dired-async)
   (when (eq action 'rsync)
     (cl-assert (executable-find "rsync") nil "No command named rsync"))
-  (let* ((rsync-switches
+  (let* (dired-create-destination-dirs ; We handle dirs creation ourself.
+         (rsync-switches
           (when (and (eq action 'rsync)
                      helm-current-prefix-arg)
             (cdr (split-string
@@ -1268,12 +1269,10 @@ ACTION can be `rsync' or any action supported by 
`helm-dired-action'."
                         :history (helm-find-files-history nil :comp-read 
nil))))))
          (dest-dir-p (file-directory-p dest))
          (dest-dir   (if dest-dir-p dest (helm-basedir dest))))
-    ;; We still need to handle directory creation for Emacs version < 27.1 that
-    ;; doesn't have `dired-create-destination-dirs' and for rsync as well.
-    (unless (or (and (boundp 'dired-create-destination-dirs)
-                     (null (eq action 'rsync)))
-                dest-dir-p
-                (file-directory-p dest-dir))
+    ;; Ignore `dired-create-destination-dirs' and handle directory creation 
from
+    ;; here like we were doing before. Dired is failing to create directories
+    ;; when e.g. symlinking some files to a not yet existing directory.
+    (unless (or dest-dir-p (file-directory-p dest-dir))
       (when (y-or-n-p (format "Create directory `%s'? " dest-dir))
         ;; When saying No here with rsync, `helm-rsync-copy-files' will raise 
an
         ;; error about dest not existing.

Reply via email to