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 using OpenMW-style root config discovery.
// OPENMW_CONFIG and OPENMW_CONFIG_DIR override discovery.
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 root
config discovery. Without those, OpenMWConfiguration::from_env tries an openmw.cfg adjacent
to the running executable, then the platform global OpenMW config. User config is loaded only
when referenced by the root config, usually through config="?userconfig?".
Path helpers intentionally distinguish the user config path (?userconfig?,
try_default_config_path), the global config path (try_default_global_config_path), and
the global data-token path (?global?, try_default_global_path). Those are not synonyms.
Serialization has two contracts. OpenMWConfiguration’s std::fmt::Display implementation
and preservation save APIs keep directory settings in their original spelling for round-trips.
OpenMWConfiguration::to_resolved_string and
OpenMWConfiguration::save_resolved_to_path emit flattened relocation-safe output, resolving
directory values and omitting chain-control entries such as config= and replace=.
Macros§
Structs§
- Config
Chain Entry - Directory
Setting - A directory path entry from an
openmw.cfgfile (data=,config=,user-data=, etc.). - Encoding
Setting - A parsed
encoding=entry from anopenmw.cfgfile. - File
Setting - A plain filename entry from an
openmw.cfgfile (content=,fallback-archive=,groundcover=). - Game
Setting Meta - Source-tracking metadata attached to every setting value.
- Generic
Setting - OpenMW
Configuration - A fully-resolved
OpenMWconfiguration chain.
Enums§
- Config
Chain Status - Config
Error - Errors that can arise while loading, mutating, or saving an
OpenMWconfiguration. - Encoding
Type - The text encoding used to interpret byte strings in plugin data.
- Game
Setting Type - A typed
fallback=Key,Valueentry from anopenmw.cfgfile.
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-localdirectory as defined by the engine’s defaults. - default_
global_ config_ path - Path to
OpenMW’s global config directory. - default_
global_ path - Path that backs the
?global?token. - default_
local_ path - Path that backs the
?local?token. - default_
root_ config_ path - Path to the default root
openmw.cfgdiscovered withOpenMWstartup semantics. - 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_ config_ path - Fallible variant of
default_global_config_path. - try_
default_ global_ path - Fallible variant of
default_global_path. - try_
default_ local_ path - Fallible variant of
default_local_path. - try_
default_ root_ config_ path - Find the default root
openmw.cfgusingOpenMW’s root config discovery order. - try_
default_ userdata_ path - Fallible variant of
default_userdata_path.