Skip to contents

Searches upward from the given path to find a webrarian collection root (directory containing _webrarian.yml).

Usage

collection_root(path = ".")

Arguments

path

Starting path to search from

Value

Path to collection root, or NULL if not found.

Examples

example_dir <- collection_example("basic")
#> ✔ Copied the "basic" example to /tmp/Rtmpv94VLa/webrarian-basic-1b0a1cea79ef
collection_root(example_dir)
#> /tmp/Rtmpv94VLa/webrarian-basic-1b0a1cea79ef

# Searching upward from a subdirectory finds the same root
collection_root(file.path(example_dir, "data"))
#> [1] "/tmp/Rtmpv94VLa/webrarian-basic-1b0a1cea79ef"

# `NULL` when there is no collection above the starting path
collection_root(tempdir())
#> NULL