Date: Mon, 16 Mar 2009 12:33:47 -0400 From: Bill Moran <wmoran@potentialtech.com> To: John Almberg <jalmberg@identry.com> Cc: freebsd-questions@freebsd.org Subject: Re: links vs real directories Message-ID: <20090316123347.2b3130a3.wmoran@potentialtech.com> In-Reply-To: <751DE4C1-73B1-4430-8373-A57B59676BBC@identry.com> References: <AA5A8761-794A-427B-9E9F-2872BD746038@identry.com> <751DE4C1-73B1-4430-8373-A57B59676BBC@identry.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In response to John Almberg <jalmberg@identry.com>: > > A little more information on this... from the Rails log, I can see > that a Ruby script in the config directory cannot load ('require') a > needed file because it can't find it: > > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require': no such file to load -- application > (MissingSource File) > > It looks like this require statement is using a relative path, like > '../path/to/file'. Does '..' not work properly with a soft link? In > other words, '..', should mean ~/app, but since the config directory > is really in '~/shared', perhaps '..' translates to '~/shared'? That > would cause the problem finding the file. That's a common problem with soft links and interpreted languages. > Is there a way around this problem? Generally, you have to fix this in the application itself. I'm not a Ruby expert, but I can list some of the methods that solve the problem in PHP: 1 If Ruby has a config value for including library files (often called a "search path"), configure it to the correct paths and tell Ruby to include the file name with the configured path information. 2 Write a wrapper around the requirement function that normalizes the path so that it works. 3 Ditch the softlink altogether and require files by absolute path. The first one is probably the most desirable, although I've had good success using PHP's __autoload() to accomplish #2. Don't know if there's an equivalent in Ruby. In any event, if you're explicitly including files by relative path, you'll have to stop doing that. It's a bad idea in any event. -- Bill Moran http://www.potentialtech.com http://people.collaborativefusion.com/~wmoran/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090316123347.2b3130a3.wmoran>