Skip to content

Commit f41b30e

Browse files
committed
Work from a fixed list of executable README paths
1 parent ae6ba35 commit f41b30e

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

R/build-readme.R

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,13 @@ build_rmd_impl <- function(
9797
build_readme <- function(path = ".", quiet = TRUE, ...) {
9898
pkg <- as.package(path)
9999

100-
regexp <- paste0(path_file(pkg$path), "/(inst/)?readme[.](r|q)md$")
101-
readme_path <- sort(
102-
path_abs(dir_ls(
103-
pkg$path,
104-
ignore.case = TRUE,
105-
regexp = regexp,
106-
recurse = 1,
107-
type = "file"
108-
)),
109-
method = "radix"
100+
readme_candidates <- c(
101+
path(pkg$path, "README.qmd"),
102+
path(pkg$path, "README.Rmd"),
103+
path(pkg$path, "inst", "README.qmd"),
104+
path(pkg$path, "inst", "README.Rmd")
110105
)
106+
readme_path <- readme_candidates[file_exists(readme_candidates)]
111107

112108
if (length(readme_path) == 0) {
113109
cli::cli_abort(

tests/testthat/_snaps/build-readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
build_readme(pkg)
2121
Condition
2222
Error in `build_readme()`:
23-
! Found multiple executable READMEs: 'README.Rmd' and 'README.qmd'. There can only be one.
23+
! Found multiple executable READMEs: 'README.qmd' and 'README.Rmd'. There can only be one.
2424

2525
# build_rmd() is deprecated
2626

0 commit comments

Comments
 (0)