R/windows.R

Defines functions dieIfWindows platformIsWindows

Documented in dieIfWindows platformIsWindows

##' Predicate to test if running on a windows platform
##' @author Brad Friedman
##' @export
##' @return Boolean:  \code{TRUE} on windows, \code{FALSE} on other platforms
platformIsWindows <- function()  {
  .Platform$OS.type == "windows"
}

##' Throw an error if platform is windows
##' @param caller Name of calling function. Default: \code{as.character(sys.call(-1))[1]}
##' @param errMesg Error message to throw under windows. Default:
##' \code{paste0(caller, "() does not run under windows")}.
##' @param isWindows Boolean, indicating if current platform is windows.
##' Default: \code{platformIsWindows()}.
##' @return Nothing
dieIfWindows <- function(caller = as.character(sys.call(-1))[1],
                         errMesg = paste0(caller, "() does not run under windows"),
                         isWindows = platformIsWindows())  {
  isWindows && stop(errMesg)
  invisible()
}

Try the AnalysisPageServer package in your browser

Any scripts or data that you put into this service are public.

AnalysisPageServer documentation built on April 28, 2020, 6:32 p.m.