Skip to contents

Checks if cache folder exists, if not returns an informative message

Usage

rb_check_cache_folder()

Value

If the cache folder exists, returns TRUE. Otherwise throws an error.

Examples


# If cache folder does not exist, it throws an error
tryCatch(rb_check_cache_folder(),
  error = function(e) {
    return(e)
  }
)
#> <usethis_error: Cache folder does not exist. Set it with `rb_get_cache_folder()` and create it with `rb_create_cache_folder()`>

# Create cache folder
rb_set_cache_folder(path = fs::path(
  tempdir(),
  "rb_cache_folder"
))
#>                      cache_folder 
#> "/tmp/RtmpRpF8Cy/rb_cache_folder" 
rb_create_cache_folder(ask = FALSE)

rb_check_cache_folder()
#> [1] TRUE