Skip to main content

Crate openmw_config

Crate openmw_config 

Source
Expand description

Parser, resolver, and serializer for OpenMW configuration chains.

OpenMW loads one or more openmw.cfg files in a chain: the root config can reference additional configs via config= entries, and each file can accumulate or override settings from its parent. This crate walks that chain, resolves token substitutions (?local?, ?global?, ?userdata?, ?userconfig?), normalises paths, and exposes the composed result as OpenMWConfiguration.

§Quick start

use openmw_config::OpenMWConfiguration;

// Load from the platform-default location (or OPENMW_CONFIG / OPENMW_CONFIG_DIR env vars)
let config = OpenMWConfiguration::from_env()?;

// Iterate content files in load order
for plugin in config.content_files_iter() {
    println!("{}", plugin.value());
}

§Configuration sources

See the OpenMW path documentation for platform-specific default locations. The environment variables OPENMW_CONFIG (path to an openmw.cfg file) and OPENMW_CONFIG_DIR (directory containing openmw.cfg) override the platform default.

Macros§

bail_config
config_err
impl_singleton_setting

Structs§

ConfigChainEntry
DirectorySetting
A directory path entry from an openmw.cfg file (data=, config=, user-data=, etc.).
EncodingSetting
A parsed encoding= entry from an openmw.cfg file.
FileSetting
A plain filename entry from an openmw.cfg file (content=, fallback-archive=, groundcover=).
GameSettingMeta
Source-tracking metadata attached to every setting value.
GenericSetting
OpenMWConfiguration
A fully-resolved OpenMW configuration chain.

Enums§

ConfigChainStatus
ConfigError
Errors that can arise while loading, mutating, or saving an OpenMW configuration.
EncodingType
The text encoding used to interpret byte strings in plugin data.
GameSettingType
A typed fallback=Key,Value entry from an openmw.cfg file.

Functions§

default_config_path
Path to input bindings and core configuration These functions are not expected to fail and should they fail, indicate either: a severe issue with the system or that an unsupported system is being used.
default_data_local_path
Path to the data-local directory as defined by the engine’s defaults.
default_global_path
Path that backs the ?global? token.
default_local_path
Path that backs the ?local? token.
default_userdata_path
Path to save storage, screenshots, navmeshdb, and data-local These functions are not expected to fail and should they fail, indicate either: a severe issue with the system or that an unsupported system is being used.
try_default_config_path
Fallible variant of default_config_path.
try_default_global_path
Fallible variant of default_global_path.
try_default_local_path
Fallible variant of default_local_path.
try_default_userdata_path
Fallible variant of default_userdata_path.