R/assertions.R

Defines functions is_usable_path

Documented in is_usable_path

#' Check if a path is usable
#'
#' This can be fiddly, follow the same rules:
#'
#' @param path path to check
#' @return TRUE iff path is usable
#'
#' @export
is_usable_path = function(path) {
  if (is.null(path)) {
    stop(msg[['path-is-null']])
  }
  if (is.na(path)) {
    stop(msg[['path-is-unknown']])
  }
  if (path == "") {
    stop(msg[['path-is-empty']])
  }
  if (length(path) != 1) {
    stop(msg[['path-is-vector']])
  }
  return(TRUE)
}
sakrejda/workflow documentation built on Nov. 18, 2024, 3:02 a.m.