Here what I use in my scripts to detect the OS
require ‘rbconfig’
class Helpers
[…]
def Helpers.platformIsWindows?
Helpers.platformIsMSWin32? ||
Helpers.platformIsMingw32? ||
Helpers.platformIsCygwin?
end
def Helpers.platformIsCygwin?
Config::CONFIG["arch"] =~ %r!.*cygwin!i
end
def Helpers.platformIsMingw32?
Config::CONFIG["arch"] =~ %r!.*mingw32!i
end
def Helpers.platformIsMSWin32?
Config::CONFIG["arch"] =~ %r!.*mswin32!i
end
[…]
end
···
-----Original Message-----
From: Kontra, Gergely [mailto:kgergely@mlabdial.hit.bme.hu]
Sent: Wednesday, August 21, 2002 1:28 PM
To: ruby-talk ML
Subject: RE: OS versionIs there a way to find out the OS version from ruby?
The above applies to *nix only. I don’t how to do it in Windows.
Well, the only thing I need it for is to detect windows