Skip to contents

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

Usage

cas_check_db_folder()

Value

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

Examples


# If database folder does not exist, it throws an error
tryCatch(cas_check_db_folder(),
  error = function(e) {
    return(e)
  }
)
#> <usethis_error: Database folder does not exist. Set it with `cas_set_db_folder()` and create it with `cas_create_db_folder()`>

# Create database folder
cas_set_db_folder(path = fs::path(
  tempdir(),
  "cas_db_folder"
))
cas_create_db_folder(ask = FALSE)

cas_check_db_folder()
#> [1] TRUE