From: Robert Klemme Date: 2005-08-11T01:01:10+09:00 Subject: Re: require and relative paths francisrammeloo@hotmail.com wrote: > Hi all, > > Suppose I have following code: > > require "./Classes/Printer" # My personal printer class > > > Now if I want to run my program Ruby needs to find the Printer.rb file > in the Classes directory. But if the script was run like this: > >> cd ~ >> ruby ~/rubydev/projects/texteditor/main.rb > > > Then the current path will be ~ and Ruby won't find > ./Classes/Printer.rb > How do I solve this problem? Did you try removing "./"? Other than that, if directory "Classes" is always relative to the script, you can use "require File.join(File.basename($0), "Classes", "Printer")". Btw, I think you don't need the extension, Ruby will figure automatically. Kind regards robert