Skip to content

Commit

Permalink
Update find_package_root() from desc
Browse files Browse the repository at this point in the history
Now we also check for '^Package: ` in the `DESCRIPTION`
file. This is the previous behavior with rprojroot.
  • Loading branch information
gaborcsardi committed Dec 10, 2023
1 parent 7a26fb1 commit e9cdf2c
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 e9cdf2c

Please sign in to comment.