---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
then to check it:
if RbConfig::CONFIG['host_os'] =~ /mswin32/
Thanks.
fyi: you don't need to use rubgems, RbConfig::CONFIG is part of Ruby itself.
Just require 'rbconfig'
> puts RbConfig::CONFIG['host_os']
>
>
> then to check it:
> if RbConfig::CONFIG['host_os'] =~ /mswin32/
- Charlie
Indeed, and here's what we do in JRuby tests to detect Windows platform:
require 'rbconfig'
WINDOWS = Config::CONFIG['host_os'] =~ /Windows|mswin/
The 'Windows' part of the regexp sees to be a legacy for older JRuby
versions. With newer JRubys (JRubies?) checking for mswin seems to be
enough.
Thanks,
--Vladimir
I normally have this method in Kernel module (so it'll be globally available)
def is_windows?
!! if PLATFORM.match /java/
java.lang.System.getProperty('os.name').match(/win/i)
else
PLATFORM.match(/win/)
end
end
As a note, it appears that many of the regexes in this thread don't
handle mingw32 (which is what the next release of windows one click
installer will be using).
Cheers!
-r
--
Posted via http://www.ruby-forum.com/.
---------------------------------------------------------------------
I would strongly recommend that the one-click installer not introduce
a new platform name. FileUtils, for example, has special-cased logic
for mswin32. There are other examples as well. Is Luis Lavena in
charge of one-click these days?
- Charlie
He is.
rubyinstaller.org
Unfortunately it's not really luis' thing--well...it kind of was to
decide to shift compilers, but that's another story.
RUBY_PLATFORM is set to mingw whether we want it to be or not :)
-r
To make sure I didn't miss something here, is this
require 'rbconfig'
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
viewed as not-good-enough-for-now when trying to determine if you're running on Windows from multiple Ruby impl's?
It appears to work for me on 1.9.1p243 from http://rubyinstaller.org/, JRuby 1.3.1, and IronRuby 0.9.1.
Jon
I think that will work as long as you have Jruby versions new enough
[older versions wouldn't work--but who uses older versions anyway?]
-r
--
Posted via http://www.ruby-forum.com/.
---------------------------------------------------------------------