View source: R/utils-projects.R
find_project_root | R Documentation |
This function checks if the current working directory is within a Quarto
project by looking for Quarto project files (_quarto.yml
or _quarto.yaml
).
Unlike get_running_project_root()
, this works both during rendering and
interactive sessions.
find_project_root(path = ".")
path |
Character. Path to check for Quarto project files. Defaults to current working directory. |
Character Path of the project root directory if found, or NULL
get_running_project_root()
for detecting active Quarto rendering
tmpdir <- tempfile()
dir.create(tmpdir)
find_project_root(tmpdir)
quarto_create_project("test-proj", type = "blog", dir = tmpdir, no_prompt = TRUE, quiet = TRUE)
blog_post_dir <- file.path(tmpdir, "test-proj", "posts", "welcome")
find_project_root(blog_post_dir)
xfun::in_dir(blog_post_dir, {
# Check if current directory is a Quarto project or in one
!is.null(find_project_root())
})
# clean up
unlink(tmpdir, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.