Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Load resource relative to required file?

Thread Tools

Load resource relative to required file?
Posts: n/a
I looked in the faq and I couldn't find my answer or a searchable
archive for the mailing list (so if anyone has that it would be

I have a 1st.rb file that loads an xml configuration file that is in
the same directory. I have 2nd.rb file that uses the 1st.rb file via
require. Everything was fine when they were in the same directory,
but when I put 1st.rb in a subdirectory, it no longer loads its .xml
file (which has also moved to the subdirectory). I get a "No such
file or directory" error.

So the question is, how does one load a resource relative to the
actual file, and not the file that required it?


************************************************** ***
Walter Szewelanczyk
IS Director
M.W. Sewall & CO. email : Removed)
259 Front St. Phone : (207) 442-7994 x 128
Bath, ME 04530 Fax : (207) 443-6284
************************************************** ***

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource/File URL Problems, relative links, servlet context and LB Java 1 06-10-2008 08:24 PM
Resource expression to access resource located in library Heinrich Moser ASP .Net 1 03-27-2008 04:25 PM
Very annoying error: Access to the path is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity Jay ASP .Net 2 08-20-2007 07:38 PM
Resource manager problem: naming for embedded resource. Dirc Khan-Evans ASP .Net 1 10-17-2005 12:52 PM
The system cannot locate the resource specified. Error processing resource avishosh XML 2 08-08-2004 06:28 AM