Resolves the directory that assets/, reports/ and zip_files/ sit
beneath, in this order:
Details
getOption("mariner.project_root"), if set. The escape hatch for a session whose working directory is not where the reports belong.pathitself, if it holds an.Rprojfile, a_quarto.yml, aDESCRIPTION, or all three mariner folders. A projectmariner_setup_project()scaffolded is therefore found again without also being an RStudio or Quarto project.An ancestor carrying one of those, reached by climbing out of
assets/,reports/orzip_files/– so bundlingreports/ch1.qmdresolves to the project that holdsreports/.pathitself, normalised.
The walk in step 3 goes through mariner folders and nothing else. A marker
in a parent directory does not claim an unrelated subdirectory: run this
from project/scratch and you get project/scratch, whatever project
carries.
.git is not a marker here, though it is one for
mariner_looks_like_project(). See the comment in R/setup.R for why.
A root argument to mariner_dirs() or mariner_setup_project() beats all
of them. Those functions call this one only when root is NULL.
Examples
mariner_project_root()
#> [1] "/Users/thomasreinke/Library/CloudStorage/OneDrive-Personal/Personal R Projects/mariner/docs/reference"
# The option wins over the search:
withr::with_options(
list(mariner.project_root = tempdir()),
mariner_project_root()
)
#> [1] "/private/var/folders/k3/k8hfzfxd11j6vy0_t2rx27yw0000gn/T/RtmpWsU1oN"