From: Alpha Blue Date: 2010-01-31T13:06:04+09:00 Subject: Re: Refining the use of file joins or file expand_path pharrington wrote: > > It'll at least work on Windows, Linux, and OSX. For what OSs will > forward slashes in the path not work? Tops-20 OpenVMS Classic MAC OS RISC OS Symbian OS Stratus VOS etc. Also, if you accidentally nest a require, say for example: --root\ -- app.rb ----\lib ---- main.rb ---- modules.rb .. note that modules.rb and main.rb are within the same directory (main). If your app.rb has require 'lib/main' .. and If your main.rb has require 'modules' ... (in E:/Gui-Development/GuiTemplate) ruby app.rb E:/Gui-Development/GuiTemplate/lib/main.rb:2:in `require': no such file to load -- modules (LoadError) from E:/Gui-Development/GuiTemplate/lib/main.rb:2:in `' from app.rb:8:in `require' from app.rb:8:in `
' rake aborted! Command failed with status (1): [ruby app.rb...] (See full trace by running task with --trace) .. now take the same require 'modules' out and place: require File.join(File.dirname(__FILE__),"modules") .. and no errors. main.rb and modules.rb are relative to each other. But, if you start an application from a different directory, the require has to have a defined path. -- Posted via http://www.ruby-forum.com/.