Skip to main content

Module import_settings

Module import_settings 

Source
Expand description

Import settings (ADR-0057): how one file, or every file of a folder, is read or baked. A file’s own settings are beside it, its full name kept (images/hero.png.meta); a folder’s defaults are in its _folder.meta, for every file in it and below it. A settings file is RON, a struct of sections, each read by the step it is named after: (onebit: (dither: bayer), indexed: (group: "ui")).

A section is a type that implements ImportSettings, registered in a Formats at start-up (register_import_settings). A format reads its section with DecodeCx::import_settings: from the nearest file of the chain that has it (settings_chain), whole, or its Default when none does. check_import_settings checks every settings file of a bundle against the registered sections.

No format may claim meta, so the walkers over a folder never read a settings file as an asset.

Constants§

FOLDER_SETTINGS
The name of a folder’s settings file: the defaults of every file in the folder and below it.
SETTINGS_EXTENSION
The extension of a settings file, which no format may claim.

Traits§

ImportSettings
A section of a settings file: a struct the step named SECTION reads (onebit, indexed), never named after a file format.

Functions§

is_settings_file
Whether the file at path is a settings file: its extension is SETTINGS_EXTENSION (in any case).
settings_chain
The settings files the file at file reads a section from, nearest first: its own (settings_of), then the FOLDER_SETTINGS of its folder and of each folder above it, up to the root.
settings_of
The path of the settings file of the file at file: images/hero.png has images/hero.png.meta.