Skip to contents

The storage layer derives every folder name through a small set of seams, each of which a user function can replace for the session:

kindsignaturenames
scenario_dirfunction(name, model, calendar, horizon)the scenario folder basename under get_scenarios_path()
store_entryfunction(type, name) — type "model", "repository" or "dataset"a store entry's basename under its root
run_labelfunction(solver) — the solver spec listthe default solve label when run = is not given
slugfunction(parts) — character vectorthe sanitize-and-join primitive used everywhere else

A hook must return a single non-empty, filesystem-safe string (no path separators; letters, digits, ./_/-); an invalid return is an ERROR naming the contract — never a silent fallback. Custom scenario and store folder names are fully safe: resolution goes through the registry and the folder manifests, never through parsing names. The run TREE (runs/<solve> vs runs/<variant>/<solve>) is structural and not hookable. A custom slug should keep dashes out of the individual parts, or folder labels become ambiguous (harmless — nothing parses them — but stated). Hooks are session-local options, not stored in projects.

Usage

set_path_builder(
  scenario_dir = NULL,
  store_entry = NULL,
  run_label = NULL,
  slug = NULL
)

get_path_builder(kind = NULL)

Arguments

scenario_dir, store_entry, run_label, slug

a function per the table (merged into the active set), or FALSE to remove that hook; NULL (default) leaves it unchanged.

kind

character, one hook name to fetch (or NULL for the whole list).

Value

set_path_builder() the previous list, invisibly; get_path_builder() the requested function (or NULL) / the list.

Examples

if (FALSE) { # \dontrun{
set_path_builder(scenario_dir = function(name, model, calendar, horizon)
  paste(name, calendar, sep = "."))
set_path_builder(scenario_dir = FALSE)   # back to the default
} # }