Load resource relative to required file?

W

walter

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
great).

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?


Walt

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

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top