Module: DataMetaXtra::Sys
- Defined in:
- lib/dataMetaXtra.rb
Overview
Constants to deal with the operational system, operational environment
Constant Summary collapse
- WINDOWS =
Platform constant -
trueif running under Microsoft Windows. (/mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
- CYGWIN =
Platform constant -
trueif running under Cygwin. (/cygwin/ =~ RUBY_PLATFORM) != nil
- MAC_OS_X =
Platform constant -
trueif running under MacOS X. (/darwin/ =~ RUBY_PLATFORM) != nil
- LINUX =
Platform constant -
trueif running under Linux. (/linux|GNU/i =~ RUBY_PLATFORM) != nil
- UNIX =
Platform constant -
trueif running under any Unix environment: Linux, MacOS X or Cygwin. LINUX || MAC_OS_X || CYGWIN
- OS_USER =
Who’s running this program - this won’t change as long as the program is running.
ENV['USERNAME'] || ENV['USER']
- OS_USER_HOME =
What’s the current user’s home path in the filesystem.
case when WINDOWS "#{ENV['HOMEDRIVE']}/#{ENV['HOMEPATH'].gsub(/\\/, '/')}" when CYGWIN "#{ENV['HOME']}" # changed in latest versions of CygWin, now you get /cygdrive/c/Users/mubergens/ #"/cygdrive/#{ENV['HOMEDRIVE'][0, 1].downcase}#{ENV['HOMEPATH'].gsub(/\\/, '/')}" else # Linux, MacOS (verified) "#{ENV['HOME']}" end