Skip to main content

persist_mod_configurations

Function persist_mod_configurations 

Source
pub fn persist_mod_configurations(
    storage: &GameStorage,
    mods: &[LoadedMod],
) -> Result<(), HookConfigError>
Expand description

Persists every currently-loaded mod’s in-memory configuration (overrides only, never a mod’s mod.json defaults) into the active configuration in mods.json. Merges with whatever’s already there rather than replacing it wholesale, so a mod not currently in mods (temporarily removed, or failed to load this session) keeps its saved overrides rather than losing them the next time anything else gets persisted. Never touches any mod’s own mod.json, so an edit here can’t clobber a mod author’s rules/parameters/defaults, and replacing a mod’s whole directory (e.g. an update) can’t take a person’s overrides for it along with it.

§Errors

Returns an error if the mods directory can’t be created or the file can’t be written.