From: Gavin Sinclair Date: 2003-11-25T18:21:35+09:00 Subject: Re: Library path relative to current .rb file On Tuesday, November 25, 2003, 8:09:36 AM, Andrew wrote: > The full solution is worse. To handle the case of the script being executed > via symlinks or relative paths, you need to do something like this: > require 'ftools' > dir = File.expand_path(__FILE__) > while File.symlink?(dir); dir = File.readlink(dir); end > SCRIPT_DIR = File.dirname(dir) > require SCRIPT_DIR+'/my_script.rb' > ... require 'pathname' dir = Pathname.new(File.expand_path(__FILE__)).realpath Gavin