]> git.cworth.org Git - sup/commitdiff
Display a default save path for attachments
authorSteve Goldman <sgoldman@tower-research.com>
Sun, 23 Nov 2008 18:53:09 +0000 (13:53 -0500)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 27 Nov 2008 00:14:35 +0000 (16:14 -0800)
Let the user specify a default path for saving attachments with
:default_attachment_save_dir: in config.yaml, and display this path in
front of the filename when saving an attachment in thread view mode.

lib/sup.rb
lib/sup/modes/thread-view-mode.rb

index 93369a5f62e01933491cd4aaa352013d673fd7ef..92ace7d8f0c3072dbb2a98393fe7fd8484945b4d 100644 (file)
@@ -221,6 +221,7 @@ else
     :confirm_no_attachments => true,
     :confirm_top_posting => true,
     :discard_snippets_from_encrypted_messages => false,
+    :default_attachment_save_dir => "",
   }
   begin
     FileUtils.mkdir_p Redwood::BASE_DIR
index 6e9256d11685cddb81f08efce89803c5c1310930..ce9f13db9fedb17992848ccf55aae996e7f0702c 100644 (file)
@@ -260,7 +260,7 @@ EOS
     chunk = @chunk_lines[curpos] or return
     case chunk
     when Chunk::Attachment
-      fn = BufferManager.ask_for_filename :filename, "Save attachment to file: ", chunk.filename
+      fn = BufferManager.ask_for_filename :filename, "Save attachment to file: ", ($config[:default_attachment_save_dir] + chunk.filename)
       save_to_file(fn) { |f| f.print chunk.raw_content } if fn
     else
       m = @message_lines[curpos]