On 16 ον, 00:27, David Masover <ni... / slaphack.com> wrote: > On Wednesday, June 15, 2011 02:55:31 PM Ilias Lazaridis wrote: > > > On 15 ïýí, 22:26, Florian Gilcher <f... / andersground.net> 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. Yes, you're right. I forgot those cases. What is sure for me now is: I need the functionality that "require_relative" provides. . -- http://lazaridis.com