R/add_resource.R

Defines functions add_resource_path

Documented in add_resource_path

#' Add resource path
#'
#' @inheritParams shiny::addResourcePath
#' @param warn_empty Boolean. If TRUE diplays a message
#'    if directory empty (Default is FALSE).
#'
#' @importFrom shiny addResourcePath
#'
#' @export
#'
add_resource_path <- function(
  prefix,
  directoryPath,
  warn_empty = FALSE
){

  list_f <- list.files(
    path = directoryPath
  )

  if( length(list_f) == 0 & warn_empty ){
    message("Unable to add your directory because it is empty")
  } else {
    addResourcePath(
      prefix,
      directoryPath
    )
  }
}
ThinkR-open/prague documentation built on Nov. 6, 2019, 12:11 a.m.