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