From ded7f509a2661b2c0715874a732b7ca48d3cdc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Sun, 10 Dec 2023 11:31:47 +0100 Subject: [PATCH] Check for 'Package' in `DESCRIPTION` when finding root Because usethis relies on this, probably accidentally, in a test case. --- R/find-package-root.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/find-package-root.R b/R/find-package-root.R index 0add54ee..40730b26 100644 --- a/R/find-package-root.R +++ b/R/find-package-root.R @@ -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)