mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 05:09:43 +00:00
Show fatal exceptions in a message box instead of cerr when running without a terminal
This commit is contained in:
parent
afa71bb622
commit
845bc5f7eb
1 changed files with 7 additions and 1 deletions
|
@ -1,7 +1,9 @@
|
|||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
|
||||
#include <SDL_messagebox.h>
|
||||
#include <SDL_main.h>
|
||||
#include "engine.hpp"
|
||||
|
||||
|
@ -280,7 +282,11 @@ int main(int argc, char**argv)
|
|||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
std::cout << "\nERROR: " << e.what() << std::endl;
|
||||
if (isatty(fileno(stdin)))
|
||||
std::cerr << "\nERROR: " << e.what() << std::endl;
|
||||
else
|
||||
SDL_ShowSimpleMessageBox(0, "OpenMW: Fatal error", e.what(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue