From: Robert Klemme Date: 2006-01-14T08:23:51+09:00 Subject: Re: ruby under cygwin & windows paths Interestingly enough my news posting didn't make it to the mail side http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/50b3c1b275cd0c6d I still think modifying the environment is a better approach than writing wrapper scripts. cheers robert 2006/1/13, Mojca Miklavec : > Hello, > > I'm using a script located under > c:\mypath\myscript.rb > which has > require 'mylib' > (I have another file c:\mypath\mylib.rb.) > > If I call ruby, the cygwin executable is called (I have no admin > rights on the computer, so I can't afford to install another native > windows version of ruby.) > > Now the problem: > If I go to c:\mypath and call myscript from there, everything works OK. > File.dirname(__FILE__) is set to "/cygdrive/c/mypath" and properly > included in $LOAD_PATH. > > But if I execute the script from somewhere else, inclusion doesn't > work any more: > > C:/mypath/myscript.rb:10:in `require': No such file to load -- mylib (LoadError) > from C:/mypath/myscript.rb:10 > > since File.dirname(__FILE__) is now set to "c:\mypath" and this one > also gets included in $LOAD_PATH. But cygwin cannot access that path > by default. > > After adding > $LOAD_PATH << '/cygdrive/c/mydir' > to the script it works again, but I may not afford to modify the > script by hardcoding the path into it since it has to work on other > computers as well. > > Is there a way to modify the script (in a compatible way with the rest > of the world) or (preferrably) to change the settings in cygwin > somehow, so that the inclusion will work again without hardcoding the > path? > > Any help would be appreciated, > Mojca Miklavec > >