The storage layer derives every folder name through a small set of seams, each of which a user function can replace for the session:
| kind | signature | names |
scenario_dir | function(name, model, calendar, horizon) | the scenario folder basename under get_scenarios_path() |
store_entry | function(type, name) — type "model", "repository" or "dataset" | a store entry's basename under its root |
run_label | function(solver) — the solver spec list | the default solve label when run = is not given |
slug | function(parts) — character vector | the 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)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
} # }
