R/unexported.R

Defines functions check_debug create_if_not

Documented in check_debug create_if_not

#' Create directory if it doesn't exist
#'
#' @param path The path to be created
#' @param recur Boolean: create directories recursively?
create_if_not <- function(path, recur = FALSE) {
  if (!dir.exists(path)) {
    dir.create(path, recursive = recur)
  }
}

#' Check if unifir should run in debug mode
#'
#' When running in debug mode, unifir will write nothing to disk.
check_debug <- function() {
  debug <- FALSE
  if (Sys.getenv("unifir_debugmode") != "" ||
    !is.null(options("unifir_debugmode")$unifir_debugmode)) {
    debug <- TRUE
  }
  debug
}

Try the unifir package in your browser

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

unifir documentation built on Dec. 3, 2022, 1:06 a.m.