From: Simon Strandgaard Date: 2004-05-01T01:20:06+09:00 Subject: Re: File.expand_path(__FILE__) "Ara.T.Howard" wrote: > > > > it seems we can't determine the absolute path of __FILE__ correctly > > after a chdir without having planned for that eventuality before the > > chdir. > > > > Can someone solve that one? > > what's wrong with this, i do it in all my programs: > > require 'pathname' > > class Main > ... > FILE = Pathname.new(__FILE__).realpath.to_s > ... > end > > what's wrong with solving it by planning for it? I don't intend to be non-friendly, but if you do so in all your Main classes, then it looks like kludge to me. You wouldn't have to make such work-arounds if __FILE__ were with an absolute path. I don't know if all this rethinking __FILE__/$0 makes sense.. -- Simon Strandgaard