Re: [Wtr-general] Help Lib Path incorrect?

2005-08-12 Thread Bret Pettichord
You are using relative paths: these are relative to the current directory 
-- not the location of the file. The current directory is where the file is 
run from. When you run from the console, you are probably running from 
the directory containing the file. By default, eclipse runs from the top of 
the project hierarchy, although this can be changed. Choose the Run... menu 
item, select the arguments tab, and change the 'working directory'.


Or you can use this:

  $LOAD_PATH. File.join(File.dirname(__FILE__), '..') if $0 == __FILE__

This makes the path relative to the location of the file, rather than the 
current directory.


Bret

At 08:36 PM 8/11/2005, Hue Mach Dieu wrote:


Hi ALL,
My structure folder as like this
My Script
-- config
   -- configLoad.xml
-- Util
   -- report.rb
-- testcases
   -- tc1.rb

I define the report.rb as like this

$LOAD_PATH  '..' if $0 == __FILE__
...
Configurator.load_xml_file('../config/configLoad.xml')
..

In tc1.rb
I use some method in report.rb

When I run it from console, don't have any problem
But when I run it within rbt (one plugin for Eclipse)
I got this error

D:/ruby/lib/ruby/site_ruby/1.8/log4r/configurator.rb:56:in `initialize':
No such file or directory - D:\MyScript/Util/config/configLoad.xml
(Errno::ENOENT)
from D:/ruby/lib/ruby/site_ruby/1.8/log4r/configurator.rb:56:in
`new'
from D:/ruby/lib/ruby/site_ruby/1.8/log4r/configurator.rb:56:in
`load_xml_file'
from D:/MyScript/Util/report.rb:25
from
D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
from
D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
from D:/MyScript/testcases/tc1.rb:18

Is any incorrect with my script?
Thank you for help

Hue


___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


_
 Bret Pettichord
 www.pettichord.com

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Help Lib Path incorrect?

2005-08-11 Thread Shao Kang Tat
Well this line stands out to me:

D:\MyScript/Util/config/configLoad.xml
^
   this slash  is different than the rest..that's my guess :)

Shao

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


RE: [Wtr-general] Help Lib Path incorrect?

2005-08-11 Thread Jonathan Kohl
That would be my guess as well. I haven't used RDT in about a month, but I
remember having path problems once in a while.

-Jonathan 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Shao Kang Tat
 Sent: August 11, 2005 8:04 PM
 To: wtr-general@rubyforge.org
 Subject: Re: [Wtr-general] Help Lib Path incorrect?
 
 Well this line stands out to me:
 
 D:\MyScript/Util/config/configLoad.xml
 ^
this slash  is different than the rest..that's my guess :)
 
 Shao
 
 ___
 Wtr-general mailing list
 Wtr-general@rubyforge.org
 http://rubyforge.org/mailman/listinfo/wtr-general
 

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general