[TxMt] Strange ruby problem

Allan Odgaard throw-away-1 at macromates.com
Mon Feb 12 16:06:03 UTC 2007


On 12. Feb 2007, at 03:42, Juan wrote:

> 	Sorry if I am posting an out of topic, but this problems raised to  
> me when hooking the save process to hold a saved file history stack:
>
> ------------- Command, Cmd-S  (pre: SaveFile)
> #!/usr/bin/env ruby
>
> H = "/Users/me/.TM_LastFiles"
>
> files = []
> last = ENV["TM_FILEPATH"]
> files << last
>
> if FileTest.exist?(H)
>   IO.readlines(H).each {|l|
>     if l != last

This will always be true, since readlines will give you the line in  
the file including its trailing newline, but TM_FILEPATH has no such.






More information about the textmate mailing list