Skip to content

Commit

Permalink
add workaround for regression in fs::file_exists()
Browse files Browse the repository at this point in the history
  • Loading branch information
salim-b committed Dec 6, 2021
1 parent 80bfe0e commit e6b268d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions R/fokus.gen.R
Expand Up @@ -87,12 +87,16 @@ rex::register_shortcuts(pkg_name = utils::packageName())

path_private <- function(...) {

dir_private <- getOption("fokus.path_private",
default = getwd())
dir_private <-
getOption("fokus.path_private",
default = getwd()) %>%
# TODO: remove `fs::path_expand()` below as soon as [issue #325](https://github.com/r-lib/fs/issues/325) is resolved
fs::path_expand()

# ensure `fokus.path_private` is valid (read access plus file `data/aargau/survey_data_2018-09-23.xlsx` exists)
is_valid_path <-
checkmate::test_directory(dir_private, access = "r") && fs::file_exists(path = fs::path(dir_private, "data/aargau/survey_data_2018-09-23.xlsx"))
checkmate::test_directory(dir_private, access = "r") &&
fs::file_exists(path = fs::path(dir_private, "data/aargau/survey_data_2018-09-23.xlsx"))

if (!is_valid_path) {

Expand Down
10 changes: 7 additions & 3 deletions Rmd/fokus.Rmd
Expand Up @@ -99,12 +99,16 @@ Assemble a FOKUS private working directory path
```{r}
path_private <- function(...) {
dir_private <- getOption("fokus.path_private",
default = getwd())
dir_private <-
getOption("fokus.path_private",
default = getwd()) %>%
# TODO: remove `fs::path_expand()` below as soon as [issue #325](https://github.com/r-lib/fs/issues/325) is resolved
fs::path_expand()
# ensure `fokus.path_private` is valid (read access plus file `data/aargau/survey_data_2018-09-23.xlsx` exists)
is_valid_path <-
checkmate::test_directory(dir_private, access = "r") && fs::file_exists(path = fs::path(dir_private, "data/aargau/survey_data_2018-09-23.xlsx"))
checkmate::test_directory(dir_private, access = "r") &&
fs::file_exists(path = fs::path(dir_private, "data/aargau/survey_data_2018-09-23.xlsx"))
if (!is_valid_path) {
Expand Down

0 comments on commit e6b268d

Please sign in to comment.