On 10/21/05, Joe Van Dyk <joevandyk / gmail.com> wrote: > > So, I have a main program that reads in a Ruby configuration file that > can also read other configuration files that are in a relative > directory. I'm having problems with the relative directory part. If > I hardcode the directory paths, everything's ok. But I don't want > /joe/configuration/config.rb to know that it's in /joe/configuration. > I just want that configuration file to be able to read > /joe/configuration/common.rb. > > Sorry if this is confusing, let me know if I can clarify the question. Don't worry Joe, this is a common problem, and fairly easily solved. All you have to do is use Ruby's built-in library search path code, with a special addition: config.rb: # Adds the directory containing this code to the search path $:.unshift File.dirname(File.expand_path(__FILE__)) # Now require will work require 'common' Ryan