Reworked the rename_file() function on Windows to work reliably and

atomically. The code was taken from the llvm project, it is complex
and hopefully it covers all the Windows file system quirks. Vojtech
has highest hopes, that this will fix the various PrusaSlicer.ini
file corruptions.

Enabled the locales switching and error handling on Linux as well,
where now the missing locales are reported and running the locale-gen
tool is recommended.
This commit is contained in:
bubnikv 2019-08-20 16:19:30 +02:00
parent a83da0f72c
commit fd3fe75d1c
6 changed files with 248 additions and 62 deletions

View file

@ -98,9 +98,10 @@ void AppConfig::load()
pt::read_ini(ifs, tree);
} catch (pt::ptree_error& ex) {
// Error while parsing config file. We'll customize the error message and rethrow to be displayed.
throw std::runtime_error(wxString::Format(_(L("Error parsing config file, it is probably corrupted. "
"Try to manualy delete the file. Your user profiles will not be affected.\n\n%s\n\n%s")),
AppConfig::config_path(), ex.what()).ToStdString());
throw std::runtime_error(
_utf8(L("Error parsing PrusaSlicer config file, it is probably corrupted. "
"Try to manualy delete the file to recover from the error. Your user profiles will not be affected.")) +
"\n\n" + AppConfig::config_path() + "\n\n" + ex.what());
}
// 2) Parse the property_tree, extract the sections and key / value pairs.