From: Rick DeNatale Date: 2006-10-10T12:05:10+09:00 Subject: Re: packaging hybrid extension? On 10/9/06, ara.t.howard@noaa.gov wrote: > On Tue, 10 Oct 2006, Rick DeNatale wrote: > > > On 10/9/06, 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. Excellent! Thanks Ara. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/