From: David Masover Date: 2011-06-16T06:27:56+09:00 Subject: Re: RFC - One word alias for require_relative On Wednesday, June 15, 2011 02:55:31 PM Ilias Lazaridis wrote: > On 15 Ιούν, 22:26, Florian Gilcher wrote: > > On Jun 15, 2011, at 9:10 PM, Ilias Lazaridis wrote: > > > require_relative 'lib/alter' > > > require './lib/alter' > > > > > > To my understanding, both should do the same thing. > > > > > > Is this right? > > > > No, the first is relative to the file, the second is relative to > > "Dir.pwd", the process working directory. > > I understand. > > Thus the first works for the main file, *and* for included files which > can use again require_relative. > > The second works only for the main file (usually executed from it's > location). Not really, no. More like, the first works wherever I'd normally be hacking around with __FILE__ to get a decent require path. The second doesn't work at all, unless it's actually what you intend. For instance, if I add a ruby script to my PATH as a command, and then run it, what directory I happen to be in when I run it is what determines what the second is relative to. Even on Windows, the working directory isn't always where the main file is.