[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sup-talk] [PATCH] change opening attachements on darwin to use open instead of run-mailcap



Hey everyone,

I've been working on getting sup to work in MacOSX (darwin).  MacOSX has a special command (open) for opening files - there is no support for mailcap.  This patch uses case to run the appropriate command depending on the architecture used.

I still haven't gotten sup to send mail yet,.. so more patches for MacOSX will probably be forthcoming.  :)

I'm loving sup so far, keep up the great work!

Cheers,

Jonah

---
 lib/sup/message-chunks.rb |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index edc40c4..581b707 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -132,7 +132,12 @@ EOS
     def initial_state; :open end
     def viewable?; @lines.nil? end
     def view_default! path
-      cmd = "/usr/bin/run-mailcap --action=view '#{@content_type}:#{path}'"
+      case Config::CONFIG['arch']
+        when /darwin/
+          cmd = "open '#{path}'"
+        else
+          cmd = "/usr/bin/run-mailcap --action=view '#{@content_type}:#{path}'"
+      end
       debug "running: #{cmd.inspect}"
       BufferManager.shell_out(cmd)
       $? == 0
-- 
1.6.3.3
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk