emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 407ee71c06: Ensure that directories exist when copying files from


From: Lars Ingebrigtsen
Subject: master 407ee71c06: Ensure that directories exist when copying files from archive
Date: Sun, 17 Jul 2022 05:23:42 -0400 (EDT)

branch: master
commit 407ee71c067de943ec3d0abee54755f59baf47cd
Author: Visuwesh <visuweshm@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Ensure that directories exist when copying files from archive
    
    * lisp/arc-mode.el (archive-copy-file): If the directory the file is
    being extracted to does not exist, then create it (bug#56603).
---
 lisp/arc-mode.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 35189f1bfd..dbb8c20209 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1073,13 +1073,16 @@ NEW-NAME."
     (user-error "Can't copy a list of files to a single file"))
   (save-excursion
     (dolist (file files)
-      (let ((write-to (if (file-directory-p new-name)
-                          (expand-file-name file new-name)
-                        new-name)))
+      (let* ((write-to (if (file-directory-p new-name)
+                           (expand-file-name file new-name)
+                         new-name))
+             (write-to-dir (file-name-directory write-to)))
         (when (and (file-exists-p write-to)
                    (not (yes-or-no-p (format "%s already exists; overwrite? "
                                              write-to))))
           (user-error "Not overwriting %s" write-to))
+        (unless (file-directory-p write-to-dir)
+          (make-directory write-to-dir t))
         (archive-goto-file file)
         (let* ((descr (archive-get-descr))
                (archive (buffer-file-name))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]