I am trying to work out a ‘better’ way of determing if my ruby code is
running on a Windows platform, and so far I’ve had to modify the
standard RUBY_PLATFORM several times depending on which version of
windows/compiler etc. it was built with. I also tried using
require ‘rbconfig’
Config::CONFIG[‘host_os’]
but found that (with 1.8.6) there are still distinction versions
reported on windows, such as a mingw32 build reporting an os of
‘mingw32’.
I came up with Config::CONFIG[‘EXEEXT’] to determine whether it is
running on Windows as opposed to any other platform we support. Windows
return “.exe” and other platforms tested come back with “”, so that
seems to work, but is there a better way?
I came up with Config::CONFIG[‘EXEEXT’] to determine whether it is
running on Windows as opposed to any other platform we support. Windows
return “.exe” and other platforms tested come back with “”, so that
seems to work, but is there a better way?
You can give a binary any extension you like on *NIX, as long as you set
“chmod +x /my/binary.whatever”.
but found that (with 1.8.6) there are still distinction versions
reported on windows, such as a mingw32 build reporting an os of
‘mingw32’.
That is because is not the OS, but also the C Runtime used to link to
Ruby and the tools to built it.
MinGW == GCC and mswin32 for VC6
Also mswin32_80 for VS2008
And you also have cygwin and other compilers.
I came up with Config::CONFIG[‘EXEEXT’] to determine whether it is
running on Windows as opposed to any other platform we support. Windows
return “.exe” and other platforms tested come back with “”, so that
seems to work, but is there a better way?