From: David Alan Black Date: 2001-11-03T07:20:21+09:00 Subject: [ruby-talk:24218] Re: require '../foo/bar' Hello -- On Sat, 3 Nov 2001, Tobias Reif wrote: > David Alan Black wrote: > > > > > > Yes. Doesn't it? > > > From file a, I require a file b (located in a directory under the > current one), which requires a file c (b and c are located in the same > directory). > For that second require (b requires c), I get a loadError. > If I run b directly (which requires c); no error. > When I run a, I again get the loadError that says b can't load c. > I can require c from a, c form b, but not c from b from a. Here's why: When b is loaded, the working directory is still the higher one. So "require 'c'" actually executes in the context of that directory, where there's (I assume) no c. If you change the require line in b to: require "subdir/c" it will work, though in the long run you might want to manipulate $:. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav