R/helpers_directory.R

Defines functions checkFileWriteAccess

Documented in checkFileWriteAccess

#' Checks if the given directory exist and can be written to.
#'
#' @keywords internal
#' @param filePath (string) A string the path to the file.
#' @return (invisible) TRUE, Stop if no access.
#'
checkFileWriteAccess <- function(filePath) {
  if (file.access(filePath[1], mode = 2) != 0) {
    stop("No write access to the path or it does not exists: ",
         filePath)
  }
  invisible(TRUE)
}

Try the amplican package in your browser

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

amplican documentation built on Nov. 8, 2020, 11:10 p.m.