From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9vue?=) Date: 2010-05-15T19:10:13+09:00 Subject: Re: difference between $0 and __FILE__ Robert Klemme wrote: > > Because the shell will also expand full names. How does your PATH look > like? I assume you set something like PATH="${PATH}:${HOME}/bin" - in > that case you'll have the absolute path to ~/bin in your PATH and > consequently the script is invoked with absolute path. > > > in fact i'm looking that because i do have Ruby class extension in a > > subfolder of "HOME/bin", namely : > > HOME/bin/ruby_ext > > where i put my extension for classes of which i could require : > > require "#{File.dirname($0)}/ruby_ext/ansi_color" > > > > what's the best way to require in that case, does i need an "absolute > > path (starting from / ) or not ? OK, i see. > IMHO the best way is to define a local location of library files and set > RUBYLIB to that directory (I use "$HOME/lib/ruby" for that because I > prefer to have lib code separate from programs, but in your case you > could also use "$HOME/bin"). > > If you want to do it on a per script basis you could do this at the > beginning of your script (i.e. before any requires): > > $:.unshift "/your/folder/here" fine thanks ! -- � Je suis s�r que la ga�t� ambigu� du dr�le de gar�on qui a bu du whisky et fait le z�bre sur un vieux ca�man � No�l dans le ca�on, a �t� b�n�fique � l'�me du po�te bl�me, ainsi qu'� son c�ur & c�tera ! � (� Jean-Paul Blanc)