[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

requiring files

Joe Van Dyk

6/2/2005 5:18:00 PM

Hi,

If I start a Ruby application from a different directory than what the
executed file is in, Ruby can't find the other files that the executed
file requires (that are in the same directory as the executed file).

Any ideas on ways to fix that?


4 Answers

Gennady

6/2/2005 5:24:00 PM

0

Joe Van Dyk wrote:
> Hi,
>
> If I start a Ruby application from a different directory than what the
> executed file is in, Ruby can't find the other files that the executed
> file requires (that are in the same directory as the executed file).
>
> Any ideas on ways to fix that?
>
$:.push File.expand_path(File.dirname(__FILE__))


Eric Hodel

6/2/2005 5:42:00 PM

0

On 02 Jun 2005, at 10:18, Joe Van Dyk wrote:

> Hi,
>
> If I start a Ruby application from a different directory than what the
> executed file is in, Ruby can't find the other files that the executed
> file requires (that are in the same directory as the executed file).
>
> Any ideas on ways to fix that?

ruby -I /path/to/libs

--
Eric Hodel - drbrain@segment7.net - http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04



Assaph Mehr

6/3/2005 2:00:00 AM

0



Gennady Bystritksy wrote:
> Joe Van Dyk wrote:
> > Hi,
> >
> > If I start a Ruby application from a different directory than what the
> > executed file is in, Ruby can't find the other files that the executed
> > file requires (that are in the same directory as the executed file).
> >
> > Any ideas on ways to fix that?
> >
> $:.push File.expand_path(File.dirname(__FILE__))

Assaph Mehr

6/3/2005 2:02:00 AM

0



Gennady Bystritksy wrote:
> Joe Van Dyk wrote:
> > Hi,
> >
> > If I start a Ruby application from a different directory than what the
> > executed file is in, Ruby can't find the other files that the executed
> > file requires (that are in the same directory as the executed file).
> >
> > Any ideas on ways to fix that?
> >
> $:.push File.expand_path(File.dirname(__FILE__))

I always prefer the verbose name of the globals:
$LOAD_PATH.push File.expand_path(File.dirname(__FILE__))

Look at the 'english' library in the stdlib:
ruby/lib/ruby/1.8/english.rb