Requiring files

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?

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__))

ruby -I /path/to/libs

···

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?

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

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__))

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