add recovery save on exception

This commit is contained in:
2018-06-27 10:36:50 +02:00
parent ef5ef5d07e
commit fa4063eeb5
3 changed files with 21 additions and 1 deletions

View File

@@ -245,6 +245,16 @@ static void SetupExceptionHandler()
BT_AddLogFile(wpath);
BT_SetPreErrHandler([](INT_PTR){
if (ui::Canvas::I)
{
auto path = App::I.data_path + "/recovery.pano";
ui::Canvas::I->project_save_thread(path);
static char abspath[MAX_PATH];
GetFullPathNameA(path.c_str(), MAX_PATH, abspath, NULL);
static char message[4096];
snprintf(message, sizeof(message), "File recovered in: %s", abspath);
MessageBoxA(NULL, message, "File Recovery", MB_OK | MB_ICONWARNING);
}
LogRemote::I.file_close();
}, 0);
}