From 957e35af0b43cd88c311a49cdf8cf7e81f3fa407 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 29 May 2022 00:48:19 -0500 Subject: [PATCH] finally --- extern/backward/backward.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/extern/backward/backward.hpp b/extern/backward/backward.hpp index e778d58f..5edda65a 100644 --- a/extern/backward/backward.hpp +++ b/extern/backward/backward.hpp @@ -4490,6 +4490,38 @@ private: printer.address = true; printer.print(st, std::cerr); + +#ifdef _WIN32 + MessageBox(NULL,"Furnace has crashed! please report this to the issue tracker immediately:\r\nhttps://github.com/tildearrow/furnace/issues/new\r\n\r\na file called furnace_crash.txt will be created in your user directory.\r\nthis will be important for locating the origin of the crash.","Error",MB_OK|MB_ICONERROR); + std::string crashLocation; + char* userProfile=getenv("USERPROFILE"); + if (userProfile==NULL) { + crashLocation="furnace_crash.txt"; + } else { + crashLocation=userProfile; + crashLocation+="\\furnace_crash.txt"; + } + FILE* crashDump=fopen(crashLocation.c_str(),"w"); +#else + FILE* crashDump=fopen("/tmp/furnace_crash.txt","w"); +#endif + + if (crashDump!=NULL) { + Printer printer; + printer.address = true; + printer.print(st, crashDump); + fclose(crashDump); + } else { +#ifdef _WIN32 + std::string str; + //Printer failedPrinter; + //failedPrinter.address = true; + //failedPrinter.print(st, str); + str+="\r\ncould not open furnace_crash.txt!\r\nplease take a screenshot of this error message box!"; + fprintf(stderr,"NOTICE: could not open furnace_crash.txt!\n"); + MessageBox(NULL,str.c_str(),"Error",MB_OK|MB_ICONERROR); +#endif + } } };