The crate dream_ini is the importer the command line and the GUI run, as a library. Everything
is exported from the crate root.
[dependencies]
dream-ini = { version = "0.4", default-features = false }
default-features = false leaves out the GUI, which the library does not use.
use std::path::Path;
use dream_ini::{ImportOptions, IniImporter};
fn main() -> Result<(), dream_ini::ImportError> {
let options = ImportOptions {
import_game_files: true,
..ImportOptions::default()
};
let result = IniImporter::new(options)
.import_optional_cfg_path(Path::new("Morrowind/Morrowind.ini"), Some(Path::new("openmw/openmw.cfg")))?;
for file in &result.cfg["content"] {
println!("{file}");
}
for warning in &result.warnings {
eprintln!("Warning: {warning}");
}
Ok(())
}| Page | Covers |
|---|---|
| Importing | IniImporter, ImportOptions, ImportResult and ImportReport |
| Parsing | MultiMap, the INI and cfg parsers, serialize_cfg and known_fallback_keys |
| Writing cfg files | Updating a cfg with its comments kept, and writing new or flattened ones |
| Reports and errors | ImportWarning, ImportEvent and ImportError |
| Other types | TextEncoding, Game, and reading plugin headers |
| Luau extension | luau::IniExtension and its constants, behind the luau feature |
Features#
| Feature | Default | Adds to the library |
|---|---|---|
luau | No | The luau module: IniExtension, an l3i extension providing @dream/ini. lua is the old name |
gui, controller-support, portmaster-gui | gui | Nothing: they build the program’s GUI |
Paths#
Paths are Path and PathBuf going in. Coming out, in cfg values and in the Luau module, they are
UTF-8 strings; a path that is not valid UTF-8 is outside what the crate supports.