-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New functions os(), os.macos() and os.linux()
- Loading branch information
Arni Magnusson
committed
Jan 7, 2019
1 parent
b4a9d2f
commit de34b87
Showing
7 changed files
with
105 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,68 @@ | ||
#' OS Family | ||
#' Operating System | ||
#' | ||
#' Determine whether operating system is Windows or Unix-compatible. | ||
#' Determine operating system name. | ||
#' | ||
#' @return | ||
#' \code{os} returns the name of the operating system, typically \code{"Linux"}, | ||
#' \code{"Darwin"}, or \code{"Windows"}. | ||
#' | ||
#' \code{os.linux}, \code{os.macos}, and \code{os.windows} return \code{TRUE} or | ||
#' \code{FALSE}. | ||
#' | ||
#' @note | ||
#' The macOS operating system identifies itself as \code{"Darwin"}. | ||
#' | ||
#' These shorthand functions can be useful when writing workaround solutions in | ||
#' platform-independent scripts. | ||
#' | ||
#' @seealso | ||
#' \code{\link{.Platform}} reports the \code{OS.type} family. | ||
#' \code{\link{Sys.info}} is the underlying function used to extract the | ||
#' operating system name. | ||
#' | ||
#' \code{\link{icesTAF-package}} gives an overview of the package. | ||
#' | ||
#' @examples | ||
#' os.unix() | ||
#' os() | ||
#' os.linux() | ||
#' os.macos() | ||
#' os.windows() | ||
#' | ||
#' @aliases os.unix | ||
#' | ||
#' @export | ||
|
||
os <- function() | ||
{ | ||
Sys.info()[["sysname"]] | ||
} | ||
|
||
#' @rdname os | ||
#' | ||
#' @export | ||
|
||
os.unix <- function() | ||
os.linux <- function() | ||
{ | ||
.Platform$OS.type == "unix" | ||
os() == "Linux" | ||
} | ||
|
||
#' @rdname os.unix | ||
#' @rdname os | ||
#' | ||
#' @export | ||
|
||
os.macos <- function() | ||
{ | ||
os() == "Darwin" | ||
} | ||
|
||
#' @rdname os | ||
#' | ||
#' @export | ||
|
||
os.windows <- function() | ||
{ | ||
.Platform$OS.type == "windows" | ||
os() == "Windows" | ||
} | ||
|
||
#' @export | ||
|
||
os.unix <- os.linux |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.