Steve Goldman
2008-Nov-23 18:53 UTC
[sup-talk] [PATCH] Display a default save path for attachments
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 | 1 +
lib/sup/modes/thread-view-mode.rb | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/sup.rb b/lib/sup.rb
index 93369a5..92ace7d 100644
--- a/lib/sup.rb
+++ b/lib/sup.rb
@@ -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
diff --git a/lib/sup/modes/thread-view-mode.rb
b/lib/sup/modes/thread-view-mode.rb
index 5f578d3..011eccd 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -259,7 +259,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]
--
1.5.6.4
--
Steve Goldman
sgoldman at tower-research.com
T: 212.219.6014
F: 212.219.6007
Tower Research Capital, LLC
377 Broadway, 11th Fl.
New York, NY 10013
William Morgan
2008-Nov-27 00:15 UTC
[sup-talk] [PATCH] Display a default save path for attachments
Reformatted excerpts from Steve Goldman''s message of 2008-11-23:> 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.Applied, thanks! -- William <wmorgan-sup at masanjin.net>