Skip to contents

Checks existence and writability of the configured path aliases set by paths_init(). Optionally creates missing directories.

Usage

paths_validate(
  paths = paths_get(),
  aliases = NULL,
  create = FALSE,
  check_writable = TRUE
)

Arguments

paths

A named list of path roots, defaulting to paths_get().

aliases

Which aliases to validate. Default validates all configured aliases.

create

Whether to create missing directories (except project, which is never created).

check_writable

Whether to check directory writability.

Value

A list with components:

  • ok: overall success (no errors)

  • results: a tibble with per-alias checks

  • warnings: character vector of advisory warnings

  • errors: character vector of errors

Details

This is intended as a lightweight "doctor" for first-time setup (especially on HPC systems) and for catching misconfiguration early (e.g., empty env vars or node-local scratch).

Examples

paths_init(quiet = TRUE)
paths_validate()
#> $ok
#> [1] TRUE
#> 
#> $results
#> # A tibble: 7 × 7
#>   alias     path                           exists writable created level message
#>   <chr>     <chr>                          <lgl>  <lgl>    <lgl>   <chr> <chr>  
#> 1 project   /home/runner/work/parade/para… TRUE   TRUE     FALSE   ok    ""     
#> 2 scratch   /tmp/RtmpfrGA9U                TRUE   TRUE     FALSE   ok    ""     
#> 3 data      /home/runner/work/parade/para… FALSE  TRUE     FALSE   warn  "Direc…
#> 4 artifacts /tmp/RtmpfrGA9U/parade-artifa… TRUE   TRUE     FALSE   ok    ""     
#> 5 registry  /tmp/RtmpfrGA9U/parade-regist… TRUE   TRUE     FALSE   ok    ""     
#> 6 config    /home/runner/work/parade/para… FALSE  TRUE     FALSE   warn  "Direc…
#> 7 cache     /home/runner/.cache/R/parade   FALSE  TRUE     FALSE   warn  "Direc…
#> 
#> $warnings
#> [1] "Missing directory for: data, config, cache"
#> 
#> $errors
#> character(0)
#> 
paths_validate(create = TRUE)
#> $ok
#> [1] TRUE
#> 
#> $results
#> # A tibble: 7 × 7
#>   alias     path                           exists writable created level message
#>   <chr>     <chr>                          <lgl>  <lgl>    <lgl>   <chr> <chr>  
#> 1 project   /home/runner/work/parade/para… TRUE   TRUE     FALSE   ok    ""     
#> 2 scratch   /tmp/RtmpfrGA9U                TRUE   TRUE     FALSE   ok    ""     
#> 3 data      /home/runner/work/parade/para… TRUE   TRUE     TRUE    ok    ""     
#> 4 artifacts /tmp/RtmpfrGA9U/parade-artifa… TRUE   TRUE     FALSE   ok    ""     
#> 5 registry  /tmp/RtmpfrGA9U/parade-regist… TRUE   TRUE     FALSE   ok    ""     
#> 6 config    /home/runner/work/parade/para… TRUE   TRUE     TRUE    ok    ""     
#> 7 cache     /home/runner/.cache/R/parade   TRUE   TRUE     TRUE    ok    ""     
#> 
#> $warnings
#> character(0)
#> 
#> $errors
#> character(0)
#>