[TxMt] LaTeX and require_cmd.rb
Alain Matthes
alain.matthes at mac.com
Mon Dec 1 15:04:44 UTC 2008
Hi
Misadventures of a Wizard's Apprentice :
I found in this message : http://lists.macromates.com/textmate/2007-February/017504.html
this idea
ENV['PATH'] = %x{sh -c '. "$BASH_ENV"; echo $PATH'}
I put this line in the file require_cmd.rb and with this line, I can
compile
without setting the PATH in the Shell Variables.
I would like to know if this idea is fine or if it' dangerous ...
Alain
the code :
ENV['PATH'] = %x{sh -c '. "$BASH_ENV"; echo $PATH'}
require ENV["TM_SUPPORT_PATH"] + "/lib/escape"
require ENV["TM_SUPPORT_PATH"] + "/lib/exit_codes"
module TextMate
class << self
def require_cmd(cmd)
unless File.executable?(cmd) or ENV['PATH'].split(':').any? { |
dir| File.executable? File.join(dir, cmd) }
TextMate::HTMLOutput.show(:title => "Can't find “#{cmd}” on
PATH.", :sub_title => "") do |io|
io << "<p>The current PATH is:</p>"
io << "<blockquote>"
ENV["PATH"].split(":").each do |p|
io << htmlize(p + "\n")
end
io << "</blockquote>"
io << "<p>Please add the directory containing
“<code>#{cmd}</code>” to <code>PATH</code> in TextMate's Shell
Variables preferences.</p>"
io << "<p>Alternatively, the PATH can be retrieved from
Terminal but this requires a relaunch: "
io << "<button onclick=
\"TextMate.system('#{(ENV["TM_SUPPORT_PATH"]+"/bin/
set_tm_path.sh").gsub(" ", "\\\\\\\\ ")}', null)\">Set PATH and
Relaunch.</button></p>"
end
TextMate.exit_show_html
end
end
end
end
More information about the textmate
mailing list