R/do_when_file.R

Defines functions do_when_file

Documented in do_when_file

#' Do when a file exists
#'
#' Process an expression once a file exists.
#'
#' @param file Name of file on which to trigger expression \code{.d}
#' @inheritParams do_when
#' @export
do_when_file <- function(.d, file, .s = 60) {
  ## check file
  if (!okay_path(file)) {
    stop("Not a valid file", call. = FALSE)
  }
  do_when_(rlang::enquo(.d), rlang::quo(file.exists(file)), .s)
}
mkearney/dowhen documentation built on May 25, 2019, 9:24 a.m.