From: Tobias Peters Date: 2003-01-13T21:30:59+09:00 Subject: Re: 'require' search path On Sun, 12 Jan 2003, Tom Sawyer wrote: > On Saturday 11 January 2003 04:23 am, Tim Bates wrote: > > I wish 'require' would count the current directory as the directory the > > file is in, rather than the directory the script is being run from. > > wish granted: > [...] This does not solve Tim's problem, as I understand it. "I wish 'require' would count the current directory as the directory the file is in, rather than the directory the script is being run from." sounds like he wants "require" to behave like C's "#include" and html's "href": relative paths should be relative to the directory of the file that contains the "require" statement / "#include" directive / "href" attribute. Your solution would treat the path as relative to the current directory of the ruby process which is what he does explicitly not want (Tim calls this "the directory the script is being run from"). How about this: def import(what) require File.join(File.dirname(caller[0]), what) end and use "import" instead of "require". T