requiring files

J

Joe Van Dyk

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?
 
G

Gennady Bystritksy

Joe said:
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__))
 
E

Eric Hodel

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
 
A

Assaph Mehr

Gennady said:
$:.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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,478
Latest member
ReginaldVi

Latest Threads

Top