Skip to contents

Determines the absolute path to the code root, using environment variables and project structure.

Usage

parse_code_root(code_root_path = NULL)

Arguments

code_root_path

character. Path to code root directory (can be relative or absolute).

Value

character(1). Absolute path to code root directory.

Details

  • Ensures all relative paths in the pipeline resolve correctly.

  • Uses WEIGHTING_CODE_PATH env var if set, else finds git root or working dir.

  • Handles R CMD CHECK and testthat environments for reproducible builds/tests.

  • Stops with error if path is not absolute during package checks.

See also

Examples

## Not run:
Sys.setenv(WEIGHTING_CODE_PATH = getwd())
parse_code_root()
#> Error in parse_code_root(): could not find function "parse_code_root"
## End(Not run)