1
0
Fork 0
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:
scrawl 2013-12-05 14:28:39 +01:00
parent afa71bb622
commit 845bc5f7eb

View file

@ -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;
}