R/Miscellaneous.R

Defines functions MustCreateDir

#' @keywords internal
MustCreateDir <- function(dir, overwrite = FALSE) {
  if (dir.exists(dir)) {
    if (!overwrite) stop(dir, " exists and overwrite is FALSE")
    return(NULL)
  }
  if (!dir.create(dir, recursive = TRUE)) {
    stop("Unable to create dir ", dir )
  }
  return(NULL)
}
WuyangFF95/SynSigRun documentation built on Oct. 7, 2022, 1:16 p.m.