Learn R Programming

assertive.reflection (version 0.0-5)

assert_is_64_bit_os: What OS is running?

Description

Is the operating system in this machine Windows/Unix/Mac based.

Usage

assert_is_64_bit_os(severity = getOption("assertive.severity", "stop"))

assert_is_32_bit(severity = getOption("assertive.severity", "stop"))

assert_is_64_bit(severity = getOption("assertive.severity", "stop"))

assert_is_bsd(severity = getOption("assertive.severity", "stop"))

assert_is_linux(severity = getOption("assertive.severity", "stop"))

assert_is_mac(severity = getOption("assertive.severity", "stop"))

assert_is_osx(severity = getOption("assertive.severity", "stop"))

assert_is_osx_cheetah(severity = getOption("assertive.severity", "stop"))

assert_is_osx_puma(severity = getOption("assertive.severity", "stop"))

assert_is_osx_jaguar(severity = getOption("assertive.severity", "stop"))

assert_is_osx_panther(severity = getOption("assertive.severity", "stop"))

assert_is_osx_tiger(severity = getOption("assertive.severity", "stop"))

assert_is_osx_leopard(severity = getOption("assertive.severity", "stop"))

assert_is_osx_snow_leopard(severity = getOption("assertive.severity", "stop"))

assert_is_osx_lion(severity = getOption("assertive.severity", "stop"))

assert_is_osx_mountain_lion(severity = getOption("assertive.severity", "stop"))

assert_is_osx_mavericks(severity = getOption("assertive.severity", "stop"))

assert_is_osx_yosemite(severity = getOption("assertive.severity", "stop"))

assert_is_osx_el_capitan(severity = getOption("assertive.severity", "stop"))

assert_is_macos_sierra(severity = getOption("assertive.severity", "stop"))

assert_is_macos_high_sierra(severity = getOption("assertive.severity", "stop"))

assert_is_macos_mojave(severity = getOption("assertive.severity", "stop"))

assert_is_macos_catalina(severity = getOption("assertive.severity", "stop"))

assert_is_macos_big_sur(severity = getOption("assertive.severity", "stop"))

assert_is_solaris(severity = getOption("assertive.severity", "stop"))

assert_is_unix(severity = getOption("assertive.severity", "stop"))

assert_is_windows(severity = getOption("assertive.severity", "stop"))

assert_is_windows_vista(severity = getOption("assertive.severity", "stop"))

assert_is_windows_7(severity = getOption("assertive.severity", "stop"))

assert_is_windows_8(severity = getOption("assertive.severity", "stop"))

assert_is_windows_8.1(severity = getOption("assertive.severity", "stop"))

assert_is_windows_10(severity = getOption("assertive.severity", "stop"))

assert_is_windows_server_2008( severity = getOption("assertive.severity", "stop") )

assert_is_windows_server_2008_r2( severity = getOption("assertive.severity", "stop") )

assert_is_windows_server_2012( severity = getOption("assertive.severity", "stop") )

assert_is_windows_server_2012_r2( severity = getOption("assertive.severity", "stop") )

is_64_bit_os()

is_32_bit()

is_64_bit()

is_bsd()

is_linux()

is_mac()

is_osx()

is_osx_cheetah()

is_osx_puma()

is_osx_jaguar()

is_osx_panther()

is_osx_tiger()

is_osx_leopard()

is_osx_snow_leopard()

is_osx_lion()

is_osx_mountain_lion()

is_osx_mavericks()

is_osx_yosemite()

is_osx_el_capitan()

is_macos_sierra()

is_macos_high_sierra()

is_macos_mojave()

is_macos_catalina()

is_macos_big_sur()

is_solaris()

is_unix()

is_windows()

is_windows_vista()

is_windows_7()

is_windows_8()

is_windows_8.1()

is_windows_10()

is_windows_server_2008()

is_windows_server_2008_r2()

is_windows_server_2012()

is_windows_server_2012_r2()

is_windows_server_2016()

is_windows_server_2019()

Arguments

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

Value

is_windows returns TRUE if the OS on the current platform is Microsoft windows-based. is_unix returns TRUE if the OS is Unix based (pretty much anything that isn't Windows, including OS X). is_mac, is_linux, is_bsd, is_solaris return TRUE if the OS is Apple OS X, Linux, FreeBSD/NetBSD, or Solaris respectively. is_64_bit_os returns TRUE when the operating system is 64-bit. The assert_* functions return nothing but throw an error if the corresponding is_* functions return FALSE.

References

With the exception of is_windows and is_unix that use .Platform$OS.type, the OS is determined from Sys.info()[["sysname"]], which (not on Windows) is calculated via the OS uname program. GNU has more information on the return value: https://www.gnu.org/software/libc/manual/html_node/Platform-Type.html and Wikipedia has a nice list of possible values: https://en.wikipedia.org/wiki/Uname#Examples The names for different versions of Windows are decribed in: http://svn.r-project.org/R/trunk/src/library/utils/src/windows/util.c

See Also

.Platform, Sys.info, version, and win.version.

Examples

Run this code
# NOT RUN {
is_unix()
is_linux()
is_bsd()
is_solaris()
if(is_windows())
{
  assertive.base::dont_stop({
    assert_is_windows_vista()
    assert_is_windows_7()
    assert_is_windows_8()
    assert_is_windows_8.1()
    assert_is_windows_10()
    assert_is_windows_server_2008()
    assert_is_windows_server_2008_r2()
    assert_is_windows_server_2012()
    assert_is_windows_server_2012_r2()
  })
}
if(is_osx()) # is_mac is a synonym
{
  assertive.base::dont_stop({
    assert_is_osx_cheetah()
    assert_is_osx_puma()
    assert_is_osx_jaguar()
    assert_is_osx_panther()
    assert_is_osx_tiger()
    assert_is_osx_leopard()
    assert_is_osx_snow_leopard()
    assert_is_osx_lion()
    assert_is_osx_mountain_lion()
    assert_is_osx_mavericks()
    assert_is_osx_yosemite()
    assert_is_osx_el_capitan()
    assert_is_macos_sierra() # note the change from OSX to macOS
  })
}
is_32_bit()
is_64_bit()
assertive.base::dont_stop(assert_is_windows())
assertive.base::dont_stop(assert_is_unix())
# }

Run the code above in your browser using DataLab