From owner-freebsd-questions@FreeBSD.ORG Mon Mar 16 16:33:49 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DCA210656E1 for ; Mon, 16 Mar 2009 16:33:49 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from mail.potentialtech.com (internet.potentialtech.com [66.167.251.6]) by mx1.freebsd.org (Postfix) with ESMTP id 6D9928FC1A for ; Mon, 16 Mar 2009 16:33:49 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from vanquish.ws.pitbpa0.priv.collaborativefusion.com (pr40.pitbpa0.pub.collaborativefusion.com [206.210.89.202]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.potentialtech.com (Postfix) with ESMTPSA id 3C0FFEBC0A; Mon, 16 Mar 2009 12:33:48 -0400 (EDT) Date: Mon, 16 Mar 2009 12:33:47 -0400 From: Bill Moran To: John Almberg Message-Id: <20090316123347.2b3130a3.wmoran@potentialtech.com> In-Reply-To: <751DE4C1-73B1-4430-8373-A57B59676BBC@identry.com> References: <751DE4C1-73B1-4430-8373-A57B59676BBC@identry.com> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.14.7; i386-portbld-freebsd7.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: links vs real directories X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2009 16:33:50 -0000 In response to John Almberg : > > 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/