View source: R/utils-projects.R
| get_running_project_root | R Documentation |
This function is to be used inside cells and will return the project root
when doing quarto_render() by detecting Quarto project environment variables.
get_running_project_root()
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.
Character Quarto project root path from set environment variables.
This function is particularly useful in Quarto document cells where you want to get the project root path dynamically during rendering. Cell example:
```{r}`r ''`
# Get the project root path
project_root <- get_running_project_root()
```
find_project_root() for finding the Quarto project root directory
project_path() for constructing paths relative to the project root
## Not run:
get_running_project_root()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.