Robust, reliable and flexible paths to files below a project root. The 'root' of a project is defined as a directory that matches a certain criterion, e.g., it contains a certain regular file.

Details

See the "Value" section in root_criterion() for documentation of root criterion objects, and criteria for useful predefined root criteria.

See also

Author

Maintainer: Kirill Müller krlmlr+r@mailbox.org (ORCID)

Examples

criteria
#> $is_rstudio_project #> Root criterion: contains a file matching "[.]Rproj$" with contents matching "^Version: " in the first line #> #> $is_r_package #> Root criterion: contains a file "DESCRIPTION" with contents matching "^Package: " #> #> $is_remake_project #> Root criterion: contains a file "remake.yml" #> #> $is_projectile_project #> Root criterion: contains a file ".projectile" #> #> $is_git_root #> Root criterion: one of #> - contains a directory ".git" #> - contains a file ".git" with contents matching "^gitdir: " #> #> $is_svn_root #> Root criterion: contains a directory ".svn" #> #> $is_vcs_root #> Root criterion: one of #> - contains a directory ".git" #> - contains a file ".git" with contents matching "^gitdir: " #> - contains a directory ".svn" #> #> $is_testthat #> Root criterion: directory name is "testthat" (also look in subdirectories: `tests/testthat`, `testthat`) #> #> $from_wd #> Root criterion: from current working directory #> #> attr(,"class") #> [1] "root_criteria"
if (FALSE) { is_r_package$find_file("NAMESPACE") root_fun <- is_r_package$make_fix_file() root_fun("NAMESPACE") }