M
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 (LoadE=
rror)
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
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 (LoadE=
rror)
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