R/provide-dir.R

Defines functions provide.dir

Documented in provide.dir

#' Provide directory
#' @description Provide directory. Create directory only if it does not exist.
#' @param path Path to create.
#' @param ... Passed to \code{dir.create}.
#' @return \code{path} on success, the empty string \code{character(1)} on failure.
#' @export 

provide.dir <- function(path, ...) {
  if (dir.exists(path) || dir.create(path, recursive = TRUE, ...)) {
    return(path)
  }
  ""
}
HughParsonage/hutils documentation built on Feb. 12, 2023, 8:26 a.m.