changeset 106026:199c98e07acd

* arc-mode.el (archive-maybe-copy): Move creation of directory ... (archive-unique-fname): ... here. (Bug#4929)
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 15 Nov 2009 13:51:58 +0000
parents b1714bb638ec
children bfb60d93cde2
files lisp/arc-mode.el
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/arc-mode.el	Sun Nov 15 07:17:00 2009 +0000
+++ b/lisp/arc-mode.el	Sun Nov 15 13:51:58 2009 +0000
@@ -818,15 +818,22 @@
 file by that name already exists in DIR, a unique new name is generated
 using `make-temp-file', and the generated name is returned."
   (let ((fullname (expand-file-name fname dir))
-	(alien (string-match file-name-invalid-regexp fname)))
-    (if (or alien (file-exists-p fullname))
-	(make-temp-file
+	(alien (string-match file-name-invalid-regexp fname))
+	(tmpfile
 	 (expand-file-name
 	  (if (if (fboundp 'msdos-long-file-names)
 		  (not (msdos-long-file-names)))
 	      "am"
 	    "arc-mode.")
-	  dir))
+	  dir)))
+    (if (or alien (file-exists-p fullname))
+	(progn
+	  ;; Maked sure all the leading directories in
+	  ;; archive-local-name exist under archive-tmpdir, so that
+	  ;; the directory structure recorded in the archive is
+	  ;; reconstructed in the temporary directory.
+	  (make-directory (file-name-directory tmpfile) t)
+	  (make-temp-file tmpfile))
       fullname)))
 
 (defun archive-maybe-copy (archive)
@@ -843,11 +850,6 @@
 		   archive)))
 	  (setq archive-local-name
 		(archive-unique-fname archive-name archive-tmpdir))
-	  ;; Maked sure all the leading directories in
-	  ;; archive-local-name exist under archive-tmpdir, so that
-	  ;; the directory structure recorded in the archive is
-	  ;; reconstructed in the temporary directory.
-	  (make-directory (file-name-directory archive-local-name) t)
 	  (save-restriction
 	    (widen)
 	    (write-region start (point-max) archive-local-name nil 'nomessage))