Skip to content

Commit

Permalink
feat(obtener_ruta_dir): add cache parameter
Browse files Browse the repository at this point in the history
Ref: #206
  • Loading branch information
GeraldineGomez committed Nov 13, 2024
1 parent 78517ea commit 1b90896
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 7 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -869,15 +869,16 @@ obtener_config_map <- function(data_agrupada, dpto, mpio,
#' enfermedad.
#' @keywords internal
obtener_ruta_dir <- function(ruta_dir = NULL,
cache = FALSE,
mensaje_error) {
if (is.null(ruta_dir)) {
if (cache) {
ruta_dir <- tools::R_user_dir("sivirep", which = "cache")
if (!dir.exists(ruta_dir)) {
creado <- dir.create(ruta_dir, recursive = TRUE)
if (!creado) {
stop("Por favor indique en el parametro ruta_dir la ruta donde
}
if (!dir.exists(ruta_dir)) {
creado <- dir.create(ruta_dir, recursive = TRUE)
if (!creado) {
stop("Por favor indique en el parametro ruta_dir la ruta donde
desea almacenar ", mensaje_error)
}
}
}
return(ruta_dir)
Expand Down
6 changes: 5 additions & 1 deletion man/obtener_ruta_dir.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1b90896

Please sign in to comment.