Figuring out what platform i'm on

Can anyone tell me how I can figure out from Ruby what platform I'm
running on? My Ruby program needs to know whether it's running on
linux, cygwin, windows etc...

Aslak

RUBY_PLATFORM

It's not perfect, but it's a good guess.

-austin

···

On Fri, 3 Dec 2004 00:44:28 +0900, aslak hellesoy <aslak.hellesoy@gmail.com> wrote:

Can anyone tell me how I can figure out from Ruby what platform I'm
running on? My Ruby program needs to know whether it's running on
linux, cygwin, windows etc...

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

aslak hellesoy wrote:

Can anyone tell me how I can figure out from Ruby what platform I'm
running on? My Ruby program needs to know whether it's running on
linux, cygwin, windows etc...

Use RUBY_PLATFORM or rbconfig.rb

$ irb
irb(main):001:0> RUBY_PLATFORM
=> "powerpc-darwin7.6.0"
irb(main):002:0>

Cheers,
Kent.

···

On Dec 2, 2004, at 10:44 AM, aslak hellesoy wrote:

Can anyone tell me how I can figure out from Ruby what platform I'm
running on? My Ruby program needs to know whether it's running on
linux, cygwin, windows etc...

Aslak

Austin Ziegler <halostatue@gmail.com> wrote in message news:<9e7db91104120207572417ae4f@mail.gmail.com>...

···

On Fri, 3 Dec 2004 00:44:28 +0900, aslak hellesoy > <aslak.hellesoy@gmail.com> wrote:
> Can anyone tell me how I can figure out from Ruby what platform I'm
> running on? My Ruby program needs to know whether it's running on
> linux, cygwin, windows etc...

RUBY_PLATFORM

It's not perfect, but it's a good guess.

-austin

For more detailed information, there is sys-uname. Available on the
RAA. Yes, it works on Windows, too. :slight_smile:

Regards,

Dan

Daniel Berger wrote:

Austin Ziegler <halostatue@gmail.com> wrote in message news:<9e7db91104120207572417ae4f@mail.gmail.com>...

Can anyone tell me how I can figure out from Ruby what platform I'm
running on? My Ruby program needs to know whether it's running on
linux, cygwin, windows etc...

RUBY_PLATFORM

It's not perfect, but it's a good guess.

-austin

For more detailed information, there is sys-uname. Available on the
RAA. Yes, it works on Windows, too. :slight_smile:

Regards,

Dan

And there's always the quick-and-dirty approach that has been mentioned before, to differentiate between windows and everything else:

   if File::ALT_SEPARATOR
     puts "I'm on windows!"
   else
     puts "I'm not on windows!"
   end

···

On Fri, 3 Dec 2004 00:44:28 +0900, aslak hellesoy >><aslak.hellesoy@gmail.com> wrote:

--
Jamis Buck
jgb3@email.byu.edu
http://www.jamisbuck.org/jamis