From: Kevin Smith Date: 2001-09-20T02:05:14+09:00 Subject: [ruby-talk:21401] Re: nested require files need path internally --- Yukihiro Matsumoto wrote: > |But, I think what he is looking for is the ability to > require a file from the same directory as the file that > does the require, not from the current directory. I have > experienced this problem too... > > Your statement is understandable. I think it's trade off > between > library search path complexity and saving few strokes of > grep and > edit. I prefer behavior simplicity this case. That's ok, if we can come up with a simple pattern to allow multiple-file apps to WORK reliably, regardless of where they are executed from, and what the LIBPATH is. This is important. I'll take a stab based on a bit of reading and only a bit of actual (inconclusive) coding: It would seem that the "main" module should examine __FILE__ or $0, and extract the path portion (if any). If there's no path, "." should be assumed. That path should then be inserted at the front of $LOAD_PATH. Now, I don't know if the path information is preserved correctly in either __FILE__ or $0. If not, then I can't think of any way to accomplish the goal, and some mechanism should be added. If my approach does work, perhaps someone (maybe me, but no promises) could bundle it up into a reusable code facet. Kevin __________________________________________________ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/