Unable to locate config file.

C

Ch Ba

I have a gemmed command line utility that requires a configuration
file. The configuration file is included in the gem and installs in the
base directory. A file in /lib needs to load it, but I am unable to do
so. Calling '../config.yml' does not locate it, nor does anything else
I've tried so far as the current directory is just wherever the command
line utility is being run from. How can I locate this configuration file
in a friendly os independent way?
 
D

dusty

 I have a gemmed command line utility that requires a configuration
file. The configuration file is included in the gem and installs in the
base directory. A file in /lib needs to load it, but I am unable to do
so. Calling '../config.yml' does not locate it, nor does anything else
I've tried so far as the current directory is just wherever the command
line utility is being run from. How can I locate this configuration file
in a friendly os independent way?

Try

File.join(File.dirname(__FILE__),'..','config.yml')
 

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,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top