find_project_root.RdThis helper starts from a directory and walks upward until it finds a directory that contains all requested marker files or directories. It is used by post-assessment scripts to locate a project root without depending on a fixed working directory.
find_project_root(
path = getwd(),
markers = "future_outputs",
winslash = "/",
mustWork = TRUE
)Character scalar. Directory to start searching from. Defaults to the current working directory.
Character vector. File or directory names that must exist directly under the project root.
Character scalar passed to [normalizePath()] on Windows.
Logical. If `TRUE`, throw an error when no matching parent directory is found. If `FALSE`, return `NA_character_`.
A normalized path to the first parent directory containing all `markers`, or `NA_character_` when `mustWork = FALSE` and no root is found.
if (FALSE) { # \dontrun{
find_project_root(markers = "future_outputs")
} # }