update osx project

This commit is contained in:
2019-07-11 22:33:58 +02:00
parent b89274e7a6
commit c4633a906f
7 changed files with 114 additions and 183 deletions

View File

@@ -3,6 +3,9 @@
#include "log.h"
#include "app.h"
#include <atomic>
#include <iomanip>
#include <ctime>
#include <sstream>
#ifdef __OBJC__
@implementation PathWithModDate
@@ -45,8 +48,15 @@ void exception_handler(NSException *exception)
LOG("exception %s\n", [[exception name] cStringUsingEncoding:NSUTF8StringEncoding]);
NSString* callstack = [[NSThread callStackSymbols] componentsJoinedByString:@"\n"];
LOG("base:\n%s\ncallstack:\n%s", base_address.c_str(), [callstack cStringUsingEncoding:NSUTF8StringEncoding]);
if (App::I.canvas && App::I.canvas->m_canvas)
App::I.canvas->m_canvas->project_save_thread(App::I.data_path + "/recovery.ppi");
auto t = std::time(nullptr);
auto tm = *std::localtime(&t);
std::ostringstream oss;
oss << std::put_time(&tm, "%d-%m-%Y %H-%M-%S");
auto path = App::I->data_path + "/" + App::I->doc_name + "-recovery (" + oss.str() + ").ppi";
if (App::I->canvas && App::I->canvas->m_canvas)
App::I->canvas->m_canvas->project_save_thread(path);
exit(0);
}
@@ -56,8 +66,15 @@ static void signal_handler (int signo) {
LOG("signal %d\n", signo);
NSString* callstack = [[NSThread callStackSymbols] componentsJoinedByString:@"\n"];
LOG("base:\n%s\ncallstack:\n%s", base_address.c_str(), [callstack cStringUsingEncoding:NSUTF8StringEncoding]);
if (App::I.canvas && App::I.canvas->m_canvas)
App::I.canvas->m_canvas->project_save_thread(App::I.data_path + "/recovery.ppi");
auto t = std::time(nullptr);
auto tm = *std::localtime(&t);
std::ostringstream oss;
oss << std::put_time(&tm, "%d-%m-%Y %H-%M-%S");
auto path = App::I->data_path + "/" + App::I->doc_name + "-recovery (" + oss.str() + ").ppi";
if (App::I->canvas && App::I->canvas->m_canvas)
App::I->canvas->m_canvas->project_save_thread(path);
exit(0);
}