Skip to main content

Module settings

Module settings 

Source
Expand description

Persistent settings store and config-path helpers.

Settings are kept in a single JSON file under the OS-specific config directory (resolved through [directories::ProjectDirs]) and exposed as a per-type Settings map: bool, i32, f32, String, raw bytes, and Vec<String>. Both the UI and the server side use the same rpfm_ipc::settings_keys constants when reading and writing, so a typo becomes a compile error rather than a silently-missed setting.

StructsΒ§

Settings
Snapshot of every persisted setting.

ConstantsΒ§

CONFIG_REDIRECT_FILE_NAME πŸ”’
File for storing the path to the user-chosen custom config folder.
DEPENDENCIES_FOLDER πŸ”’
SCRIPTS_FOLDER πŸ”’
Folder under config_path where the user drops plugin scripts (.py/.lua).
SETTINGS_FILE_NAME πŸ”’
TABLE_PATCHES_FOLDER πŸ”’
TABLE_PROFILES_FOLDER πŸ”’
TRANSLATIONS_LOCAL_FOLDER πŸ”’
TRANSLATIONS_REMOTE_FOLDER πŸ”’

StaticsΒ§

SETTINGS
The single Settings instance for this server process.
SETTINGS_CHANGED
Broadcasts the SettingsSnapshot resulting from every successful write to SETTINGS, so every connected session can push it to its own client and keep their settings caches in sync without requiring a reconnect.

FunctionsΒ§

backup_autosave_path
This function returns the autosave path.
backup_path πŸ”’
Path of the backup of a settings file: the same file, with .bak appended.
clear_config_path
Recursively deletes the config folder, then re-runs init_config_path to recreate the standard sub-folders. Refuses to delete anything outside config_path.
config_path
This function returns the active config path: the user’s custom folder if one is set, or the default otherwise.
custom_config_path
This function returns the user-configured custom config folder, or None if RPFM uses the default one.
default_config_path
This function returns RPFM’s default config path, ignoring any custom-folder redirect.
dependencies_cache_path
This function returns the dependencies path.
error_path
This function returns the path where crash logs are stored.
init_config_path
Function to initialize the config folder, so RPFM can use it to store his stuff.
lua_autogen_base_path
This function returns the lua autogen path.
lua_autogen_game_path
This function returns the lua autogen path for a specific game.
mutate_settings
Applies a mutation to the shared SETTINGS store and broadcasts the resulting snapshot on SETTINGS_CHANGED if it succeeds.
old_ak_files_path
Folder under config_path holding archived Empire/Napoleon Assembly Kit definitions (no AK was ever shipped for these games, so RPFM bundles a frozen copy via the old_ak_files submodule).
schemas_path
This function returns the schema path.
scripts_path
Folder under config_path where the user drops plugin scripts shown in the PackFile contents context menu.
set_custom_config_path
This function sets (or clears, when passed None) the custom config folder and initializes it.
table_patches_path
Folder under config_path where user-side schema patches live.
table_profiles_path
Folder under config_path where saved table view profiles (column orders, filters, hidden columns) are persisted.
translations_local_path
Folder under config_path where the user’s local mod translations are stored (one JSON per pack/language).
translations_remote_path
Folder under config_path where the local clone of the Translation Hub repository is mirrored.