Permalink
Browse files

Command works now even if TM_APP_PATH is not defined

  • Loading branch information...
1 parent 5639a59 commit 45720d6be9e34ed340ae5b6e82386b53f7d44eee Bartosz Blimke committed Mar 19, 2010
Showing with 4 additions and 3 deletions.
  1. +4 −3 Commands/Copy With Style.tmCommand
@@ -8,8 +8,9 @@
<string>ruby -e'
require "jcode"
$KCODE="U"
- require "#{ENV["TM_APP_PATH"]}/Contents/SharedSupport/Bundles/TextMate.tmbundle/Support/lib/doctohtml.rb"
- require "#{ENV["TM_APP_PATH"]}/Contents/SharedSupport/Support/lib/progress.rb"
+ app_path = ENV["TM_APP_PATH"] || %x{ps -xwwp "$TM_PID" -o "command="}.sub(%r{/Contents/MacOS/.*\n}, "")
+ require "#{app_path}/Contents/SharedSupport/Bundles/TextMate.tmbundle/Support/lib/doctohtml.rb"
+ require "#{app_path}/Contents/SharedSupport/Support/lib/progress.rb"
unit = ENV.has_key?("TM_SELECTED_TEXT") ? "selection" : "document"
TextMate.call_with_progress(:message => "Creating HTML version of #{unit}…") do
print document_to_html( STDIN.read, :include_css => true )
@@ -28,4 +29,4 @@
<key>uuid</key>
<string>BAAC7FD1-DC7C-4F18-AAD9-EFA93585451B</string>
</dict>
-</plist>
+</plist>

0 comments on commit 45720d6

Please sign in to comment.