Skip to content

Commit

Permalink
Check for 'Package' in DESCRIPTION when finding root
Browse files Browse the repository at this point in the history
Because usethis relies on this, probably accidentally,
in a test case.
  • Loading branch information
gaborcsardi committed Dec 10, 2023
1 parent a618bf6 commit ded7f50
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/find-package-root.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ find_package_root <- function(path = ".") {
)
max_depth <- 100
for (i in 1:max_depth) {
if (file.exists(file.path(cur_path, "DESCRIPTION"))) {
dsc_path <- file.path(cur_path, "DESCRIPTION")
if (file.exists(dsc_path) &&
any(grepl("^Package: ", readLines(dsc_path)))) {
return(cur_path)
} else if (is_root(cur_path)) {
stop(errmsg)
Expand Down

0 comments on commit ded7f50

Please sign in to comment.