* elmo-maildir.el (elmo-folder-rename-internal): New method,
authoryoichi <yoichi>
Mon, 10 Feb 2003 06:01:49 +0000 (06:01 +0000)
committeryoichi <yoichi>
Mon, 10 Feb 2003 06:01:49 +0000 (06:01 +0000)
copied from localdir's one.

elmo/ChangeLog
elmo/elmo-maildir.el

index 5a85509..4f0241b 100644 (file)
@@ -1,5 +1,8 @@
 2003-02-10  Yoichi NAKAYAMA  <yoichi@eken.phys.nagoya-u.ac.jp>
 
+       * elmo-maildir.el (elmo-folder-rename-internal): New method,
+       copied from localdir's one.
+
        * elmo-pipe.el (elmo-folder-rename): New method, rename
        destination folder with leaving source folder as it is.
 
index 6fe8c22..0cf693c 100644 (file)
@@ -482,6 +482,20 @@ file name for maildir directories."
          t)
       (error nil))))
 
+(luna-define-method elmo-folder-rename-internal ((folder elmo-maildir-folder)
+                                                new-folder)
+  (let* ((old (elmo-maildir-folder-directory-internal folder))
+        (new (elmo-maildir-folder-directory-internal new-folder))
+        (new-dir (directory-file-name (file-name-directory new))))
+    (unless (file-directory-p old)
+      (error "No such directory: %s" old))
+    (when (file-exists-p new)
+      (error "Already exists directory: %s" new))
+    (unless (file-directory-p new-dir)
+      (elmo-make-directory new-dir))
+    (rename-file old new)
+    t))
+
 (require 'product)
 (product-provide (provide 'elmo-maildir) (require 'elmo-version))