Skip to main content

record_new_install_theme

Function record_new_install_theme 

Source
pub fn record_new_install_theme(
    context: &ProductContext,
    theme: &str,
    product_themes: ProductThemes,
) -> Result<bool, String>
Expand description

Records theme as the saved theme when context‘s product has neither a config file nor a state file: a new install. Returns whether it recorded. product_themes are the app’s own theme documents (ProductBuild.product_themes, &[] for none), which theme may be a variant of. An existing install, including one whose files are unreadable or malformed, is left alone. Nothing is written, and an error returned, when a new install’s product themes fail the checks startup makes, when theme is not a variant of the product’s theme catalogue, or when the files’ folder cannot be read, so a new install cannot be told from an existing one. It first names the data directory after the context’s binary, as prepare_context does, and returns that error, writing nothing, when a data path was read under another name before. Only the desktop app calls this, before it starts; command-line and headless runs must not.