From: John Platte Date: 2004-04-30T23:58:03+09:00 Subject: Re: File.expand_path(__FILE__) On 2004 Apr 30, at 9:39, Robert Klemme wrote: >> I see Perl uses relative paths for both __FILE__ and $0...and since a >> lot of Ruby scripts use "if __FILE__ == $0", those two should keep >> following the same policy. So I don't expect that behavior to change >> for my odd little case. > > .... or operators are overloaded to ensure proper behavior. I can't imagine that would lead to increased predictability! On this topic, however, it'd be nice to have a method like this_file_invoked? that encapsulated the $0 == __FILE__ idiom. >> Surely there's an existing solution to this within Ruby or Perl or >> some >> other language? > > See my other post: > > # at the top of script > FILE = File.expand_path( __FILE __ ) Yes, that snippet was a workaround I was thanking you for, but I don't consider it a solution to the problem: 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? -- Ryan "John" Platte Custom services, NIKA Consulting http://nikaconsulting.com/