On Tue, 10 Oct 2006, Rick DeNatale wrote:

> On 10/9/06, ara.t.howard / noaa.gov <ara.t.howard / noaa.gov> wrote:
>
>>    this = File.dirname __FILE__
>>    archdir = File.join this, arch
>> 
>>    lib = File.join archdir, "foo.#{ dlext }"
>>    require lib
>
> The problem is that __FILE__ only has the file name, not the path, so
>
> File.dirname(__FILE__) => '.'

na.  it's always relative to the current directory, so you just need to expand
it (i forgot this part - sorry)


   mussel:~ > cat /tmp/b.rb
   puts File.dirname((__FILE__))

   mussel:~ > ruby /tmp/b.rb
   /tmp



   mussel:~ > cat /tmp/a.rb
   puts File.dirname(File.expand_path(__FILE__))

   mussel:~ > ruby /tmp/b.rb
   /tmp

   mussel:~ > ruby -I/tmp -r a.rb -e nil
   /tmp


i use this technique all over the place for relative requires:

   http://codeforpeople.com/lib/ruby/rq/rq-2.3.4/lib/rq-2.3.4.rb


sorry for confusion.

cheers.

-a
-- 
in order to be effective truth must penetrate like an arrow - and that is
likely to hurt. -- wei wu wei