Skip to content

Commit 88afadc

Browse files
authored
Check for file existence and check early (#2363)
* Check for file existence and check early * Bump minimum version of cli; use cli_abort()
1 parent 6d6ade5 commit 88afadc

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Depends:
2323
usethis (>= 2.0.1)
2424
Imports:
2525
callr (>= 3.6.0),
26-
cli (>= 2.4.0),
26+
cli (>= 3.0.0),
2727
desc (>= 1.3.0),
2828
ellipsis (>= 0.3.1),
2929
fs (>= 1.5.0),

R/build-readme.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ build_rmd <- function(files, path = ".", output_options = list(), ..., quiet = T
1919
rlang::check_installed("rmarkdown")
2020
save_all()
2121

22+
paths <- files
23+
abs_files <- is_absolute_path(files)
24+
paths[!abs_files] <- path(pkg$path, files[!abs_files])
25+
26+
ok <- file_exists(paths)
27+
if (any(!ok)) {
28+
cli::cli_abort("Can't find file{?s}: {.path {files[!ok]}}.")
29+
}
30+
2231
cli::cli_alert_info("Installing {.pkg {pkg$package}} in temporary library")
2332
withr::local_temp_libpaths()
2433
install(pkg, upgrade = "never", reload = FALSE, quick = TRUE, quiet = quiet)
2534

2635
# Ensure rendering github_document() doesn't generate HTML file
2736
output_options$html_preview <- FALSE
2837

29-
paths <- files
30-
31-
abs_files <- is_absolute_path(files)
32-
33-
paths[!abs_files] <- path(pkg$path, files[!abs_files])
3438

3539
for (path in paths) {
3640
cli::cli_alert_info("Building {.path {path}}")

0 commit comments

Comments
 (0)