On 3/3/2006, at 17:18, Gavin Kistner wrote:
[...] I put one of my files in a path with a space in the name, and it took me a fair amount of experimenting to figure out how TextMate and Lua independently wanted to see the URL.
I have this function in the Show TODO List command:
def TextMate.file_link (file, line = 0) return "txmt://open/?url=file://" + file.gsub(/[^a-zA-Z0-9.-/]/) { |m| sprintf("%%%02X", m[0]) } + "&line=" + line.to_s end
I will move it to the textmate ruby lib in Support/lib so that Ruby commands can just use this one.
To pass that to Lua, I needed to escape the space char: file_path = Pathname.new( ARGV[0].gsub( %r{([^\w/.])}, '\\\1' ) ) #=> /Users/gavinkistner/Desktop/pork\ butt/bling/tmp.lua
I assume that “pass that to Lua” means through the shell? There are also a few shell_escape functions in various commands, where instead I should harmonize and (again) move to the textmate ruby lib :)