
Get the root of the currently running Quarto project
Source:R/utils-projects.R
get_running_project_root.Rd
This function is to be used inside cells and will return the project root
when doing quarto_render()
by detecting Quarto project environment variables.
Details
Quarto sets QUARTO_PROJECT_ROOT
and QUARTO_PROJECT_DIR
environment
variables when executing commands within a Quarto project context (e.g.,
quarto render
, quarto preview
). This function detects their presence.
Note that this function will return NULL
when running code interactively
in an IDE (even within a Quarto project directory), as these specific
environment variables are only set during Quarto command execution.
Use in Quarto document cells
This function is particularly useful in Quarto document cells where you want to get the project root path dynamically during rendering. Cell example:
See also
find_project_root()
for finding the Quarto project root directoryproject_path()
for constructing paths relative to the project root