In article <20040212.034830.26322313.maki / rubycolor.org>, Masayoshi Takahashi wrote: [...] >Masahiro Tomita proposed to add Ruby/MySQL, MySQL client library >written in Ruby, in the standard distribution with ruby-dbi. Great. This would save the headaches some win32 users have been having with the other mysql library. (And also help license-wise.) > [ruby-dev:22763] $: trick in test/* > [ruby-dev:22788] relative load/require (Re: Re: $: trick in test/*) > >NaHi pointed out that some test cases in src/ruby/test/* >changed the value of $: and load files in current directories. >But he didn't think it smart because the value of $: were >shared with all test cases, so he proposed to delete >this $: trick. > >But Tanaka Akira had a different opinion. He suggests >to solve this problem generally; to add a new method >to load with relative path. >Matz disagree to make the require method load libraries >with relative path, but he allowed other method to do it. >Some details are not determined yet: > > * name > * handling of symbolic link [...] I use a method I wrote called `File.relative'. For example /home/tim/work/relative/main.rb: class << File def relative(base, restpath) File.join(File.dirname(base), restpath) end end # Loads /home/tim/work/relative/foo/bar.rb require File.relative(__FILE__, 'foo/bar') One thing I like about this solution is that it can be used for more than just `require'. -- Tim Sutherland <timsuth / ihug.co.nz> 2004 SDKACM President Software Developers' Klub - the University of Auckland ACM Student Chapter http://www.sdkacm.com/