mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Introduce proper error handling for file streams
This commit is contained in:
parent
c38e0d05bf
commit
39fd9b93c3
23 changed files with 235 additions and 149 deletions
|
@ -147,18 +147,15 @@ static void MSVC_LocaleWorkaround(int argc, char* argv[])
|
|||
exit(0);
|
||||
// NOTREACHED
|
||||
} else {
|
||||
char buffer[1024];
|
||||
auto e = GetLastError();
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), buffer,
|
||||
sizeof(buffer) - 1, NULL);
|
||||
|
||||
errorstream << "*******************************************************" << std::endl;
|
||||
errorstream << "CMD: " << app_name << std::endl;
|
||||
errorstream << "Failed to restart with current locale: " << std::endl;
|
||||
errorstream << buffer;
|
||||
errorstream << "Expect language to be broken!" << std::endl;
|
||||
errorstream << "*******************************************************" << std::endl;
|
||||
errorstream
|
||||
<< "*******************************************************" << '\n'
|
||||
<< "CMD: " << app_name << '\n';
|
||||
<< "Failed to restart with current locale: ";
|
||||
<< porting::ConvertError(e) << '\n';
|
||||
<< "Expect language to be broken!" << '\n';
|
||||
<< "*******************************************************" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue