Require fills $" with (the short names of) the library files it
is able to find. When the program has ended, RubyScript2Exe
tries to match the libraries in $" with the directories in $:
and the default extensions in order to collect the files. But,
since $: might change when running the program (RubyGems!...),
the files RubyScript2Exe finds are not necessarily the ones
Ruby finds.
I came up with this solution (see below). Just redefine require
before executing the application and $" will be filled with the
full names of the library files. Seems to work....
Any suggestions or considerations?
gegroet,
Erik V. - http://www.erikveen.dds.nl/
···
----------------------------------------------------------------
alias :old_require :require
def require(lib, *rest)
extensions = ["", ".rb", ".so", ".o", ".dll"]
search_list = $:.collect{|dir| extensions.collect{|ext|
File.expand_path(lib + ext, dir)}}.flatten
found = search_list.find{|file| File.file?(file)}
lib = found unless found.nil?
old_require(lib, *rest)
end
----------------------------------------------------------------
Hi,
At Tue, 4 Oct 2005 00:41:47 +0900,
Erik Veenstra wrote in [ruby-talk:158842]:
I came up with this solution (see below). Just redefine require
before executing the application and $" will be filled with the
full names of the library files. Seems to work....
1.9 does so.
···
--
Nobu Nakada
> I came up with this solution (see below). Just redefine
> require before executing the application and $" will be
> filled with the full names of the library files. Seems to
> work....
1.9 does so.
Quick check...
Well, uh, just partly. It does expand all pathes, except for
enumerator.so. Where does enumerator.so come from? Why isn't it
a full path?
Running on Cygwin on XP.
gegroet,
Erik V. - http://www.erikveen.dds.nl/
···
----------------------------------------------------------------
$ ./ruby.exe -v
ruby 1.9.0 (2005-10-04) [i386-cygwin]
$ ./ruby.exe -e 'p $"'
["enumerator.so"]
$ ./ruby.exe -r rbconfig -e 'p $"'
["enumerator.so", "/scratch/snapshot/ruby/rbconfig.rb"]
----------------------------------------------------------------
Hi,
At Tue, 4 Oct 2005 21:41:48 +0900,
Erik Veenstra wrote in [ruby-talk:158980]:
Well, uh, just partly. It does expand all pathes, except for
enumerator.so. Where does enumerator.so come from? Why isn't it
a full path?
It is built-in now, and defined for backward compatibility
purpose.
···
--
Nobu Nakada