From 24fb2d86cfa5514e209246ac0e4e20b81d15811c Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Thu, 10 Jun 2021 16:38:43 -0700 Subject: [PATCH] regions_meow and regions_fao: create base dir if does not exist --- R/ecoregion.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/ecoregion.R b/R/ecoregion.R index b182472..b5a39b1 100644 --- a/R/ecoregion.R +++ b/R/ecoregion.R @@ -112,6 +112,7 @@ eco_region <- function(x, dataset = "meow", region, #' @rdname eco_region regions_meow <- function() { path <- file.path(scrubr_cache$cache_path_get(), "meow.geojson") + dir.create(dirname(path), showWarnings = FALSE, recursive = TRUE) if (file.exists(path)) { message("meow.geojson exists in the cache") } else { @@ -125,6 +126,7 @@ regions_meow <- function() { #' @rdname eco_region regions_fao <- function() { path <- file.path(scrubr_cache$cache_path_get(), "fao.geojson") + dir.create(dirname(path), showWarnings = FALSE, recursive = TRUE) if (file.exists(path)) { message("fao.geojson exists in the cache") } else {