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/RtmpQU25pJ/webrarian-basic-206b666e6140
collection_root(example_dir)
#> /tmp/RtmpQU25pJ/webrarian-basic-206b666e6140

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

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