What OS is running?

Share:

Description

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

Usage

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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_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_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()

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35