1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-17 15:16:34 +00:00

Handle encoding a bit more cleverly

* use the value from the existing openmw.cfg if it exists and we weren't told to use something else on the command line
* write the value to openmw.cfg if it wasn't there or we've overridden it
This commit is contained in:
AnyOldName3 2025-01-17 01:34:08 +00:00
parent e345fca99a
commit 33553c0cf7

View file

@ -126,12 +126,20 @@ int wmain(int argc, wchar_t* wargv[])
MwIniImporter importer;
importer.setVerbose(vm.count("verbose") != 0);
MwIniImporter::multistrmap cfg = importer.loadCfgFile(cfgFile);
// Font encoding settings
std::string encoding(vm["encoding"].as<std::string>());
std::string encoding;
if (vm["encoding"].defaulted() && cfg.contains("encoding") && !cfg["encoding"].empty())
encoding = cfg["encoding"].back();
else
{
encoding = vm["encoding"].as<std::string>();
cfg["encoding"] = {encoding};
}
importer.setInputEncoding(ToUTF8::calculateEncoding(encoding));
MwIniImporter::multistrmap ini = importer.loadIniFile(iniFile);
MwIniImporter::multistrmap cfg = importer.loadCfgFile(cfgFile);
if (!vm.count("fonts"))
{