[Ironruby-core] resolv.rb won't work

Ivan Porto Carrero ivan at flanders.co.nz
Wed Aug 26 17:24:47 EDT 2009


Hi
The resolv.rb file from the standard library won't work because it expects
the win32/resolv library to work, which isn't included.

I suppose this thing will return in many places as the way MRI often detects
whether it's running on windows is by asking the RUBY_PLATFORM variable and
then matching it against /mswin32|mingw|bccwin/
but on mono that also returns i386-mswin32
using rbconfig the host_os info is wrong and using RUBY_PLATFORM it will
return something that includes mswin32 even on linux/mac osx.

to fix it you have to change the file in lib/ruby/1.8/resolv.rb

starting on line 286 replace the if .. then .. else with

if ENV['OS'] =~ /win/i
      DefaultFileName = System::Environment::system_directory +
"\\drivers\\etc\\hosts"
    else
      DefaultFileName = '/etc/hosts'
    end

Before I push my change I'd like to know if ENV['OS'] also returns a string
containing win on windows 9x/Me.
And I don't even remember if the hosts path is the same as it is on NT
incarnations

---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090826/c1771a60/attachment.html>


More information about the Ironruby-core mailing list