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:
parent
e345fca99a
commit
33553c0cf7
1 changed files with 10 additions and 2 deletions
|
@ -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"))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue