Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve robusness of data dir check #99

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion R/get.R
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,14 @@ spod_get_data_dir <- function(quiet = FALSE) {
if (data_dir_env == "") {
if (isFALSE(quiet)) warning("Warning: SPANISH_OD_DATA_DIR is not set. Using the temporary directory, which is not recommended, as the data will be deleted when the session ends.\n\n To set the data directory, use `Sys.setenv(SPANISH_OD_DATA_DIR = '/path/to/data')` or set SPANISH_OD_DATA_DIR permanently in the environment by editing the `.Renviron` file locally for current project with `usethis::edit_r_environ('project')` or `file.edit('.Renviron')` or globally for all projects with `usethis::edit_r_environ('user')` or `file.edit('~/.Renviron')`.")
data_dir_env <- tempdir() # if not set, use the temp directory
} else {
data_dir_env <- fs::path_real(data_dir_env)
}
# check if dir exists and create it if it doesn't
if (!fs::dir_exists(data_dir_env)) {
fs::dir_create(data_dir_env)
}
return(fs::path_real(data_dir_env))
return(data_dir_env)
}

#' retrieves the zones data
Expand Down
Loading