From 87f2c976ea97f43f78082f3db536a57c454bfdd5 Mon Sep 17 00:00:00 2001 From: yoichi Date: Wed, 15 Jan 2003 11:04:02 +0000 Subject: [PATCH] * elmo-localdir.el (elmo-folder-rename-internal): If new-dir exist as non-directory, cause error before rename-file. * elmo-archive.el (elmo-folder-rename-internal): Create directory apropriately, mimic localdir's one. Based on the patch from KAMO Tomoyuki . --- elmo/ChangeLog | 8 ++++++++ elmo/elmo-archive.el | 8 +++++++- elmo/elmo-localdir.el | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 01ef5d5..7934065 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,11 @@ +2003-01-15 Yoichi NAKAYAMA + + * elmo-localdir.el (elmo-folder-rename-internal): If new-dir exist + as non-directory, cause error before rename-file. + * elmo-archive.el (elmo-folder-rename-internal): Create directory + apropriately, mimic localdir's one. + Based on the patch from KAMO Tomoyuki . + 2003-01-10 Tsutomu OKADA * elmo-map.el (elmo-folder-pack-numbers): Fix name of the function. diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 341428b..40bfcf8 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -457,7 +457,11 @@ TYPE specifies the archiver's symbol." (luna-define-method elmo-folder-rename-internal ((folder elmo-archive-folder) new-folder) (let* ((old-arc (elmo-archive-get-archive-name folder)) - (new-arc (elmo-archive-get-archive-name new-folder))) + (new-arc (elmo-archive-get-archive-name new-folder)) + (new-dir (directory-file-name + (elmo-archive-get-archive-directory new-folder)))) + (if elmo-archive-treat-file + (setq new-dir (directory-file-name (file-name-directory new-dir)))) (unless (and (eq (elmo-archive-folder-archive-type-internal folder) (elmo-archive-folder-archive-type-internal new-folder)) (equal (elmo-archive-folder-archive-prefix-internal @@ -469,6 +473,8 @@ TYPE specifies the archiver's symbol." (error "No such file: %s" old-arc) (if (file-exists-p new-arc) (error "Already exists: %s" new-arc) + (if (not (file-directory-p new-dir)) + (elmo-make-directory new-dir)) (rename-file old-arc new-arc) t)))) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 2fa24e5..1685988 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -311,7 +311,7 @@ (error "No such directory: %s" old) (if (file-exists-p new) (error "Already exists directory: %s" new) - (if (not (file-exists-p new-dir)) + (if (not (file-directory-p new-dir)) (elmo-make-directory new-dir)) (rename-file old new) t)))) -- 1.7.10.4