Ryan Davis wrote:
> 
> On Jul 16, 2009, at 06:30 , Roger Pack wrote:
> 
>> __DIR__ would be a nice constant.
> 
> Don't forget __DIR_DIR__ and __DIR_DIR_DIR__!!
> 
> ...This feels vaguely familiar...

One way to get __DIR__ is:

File.expand_path("..", __FILE__)

and it has the advantage of iterating nicely:

File.expand_path("../../..", __FILE__)

It does have the side-effect of conversion to an absolute path, but that 
is usually (in my experience) part of the process anyway, so __DIR__ 
doesn't save much effort, even in the one iteration case.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407