From 5d65b4092fc901200af4687741dad7de51a25d8f Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 6 Oct 2022 23:19:43 -0400 Subject: [PATCH] Move Code Around --- dependencies/zenity/src | 2 +- launcher/src/crash-report.c | 28 +++++++++++++------------ libreborn/include/libreborn/config.h.in | 1 + 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/dependencies/zenity/src b/dependencies/zenity/src index 58787016c..c9ff7f17a 160000 --- a/dependencies/zenity/src +++ b/dependencies/zenity/src @@ -1 +1 @@ -Subproject commit 58787016ce6f72bdc4dff75721c8936779f6c20c +Subproject commit c9ff7f17aa81d9d1566d426c87a184831ce4f7d9 diff --git a/launcher/src/crash-report.c b/launcher/src/crash-report.c index 1205ce2f8..34c3780dc 100644 --- a/launcher/src/crash-report.c +++ b/launcher/src/crash-report.c @@ -38,6 +38,8 @@ static void show_report(const char *log_filename) { "--filename", log_filename, "--no-wrap", "--font", "Monospace", + "--save-filename", MCPI_VARIANT_NAME "-crash-report.log", + "--ok-label", "Exit", NULL }; safe_execvpe(command, (const char *const *) environ); @@ -58,6 +60,19 @@ static void exit_handler(__attribute__((unused)) int signal) { static char log_filename[] = MCPI_LOGS_DIR "/XXXXXX"; static int log_file_fd = -1; void setup_log_file() { + // Ensure Temporary Directory + { + // Check If It Exists + struct stat tmp_stat; + int exists = stat(MCPI_LOGS_DIR, &tmp_stat) != 0 ? 0 : S_ISDIR(tmp_stat.st_mode); + if (!exists) { + // Doesn't Exist + if (mkdir(MCPI_LOGS_DIR, S_IRUSR | S_IWUSR | S_IXUSR) != 0) { + ERR("Unable To Create Temporary Folder: %s", strerror(errno)); + } + } + } + // Create Temporary File log_file_fd = mkstemp(log_filename); if (log_file_fd == -1) { @@ -130,19 +145,6 @@ void setup_crash_report() { #define BUFFER_SIZE 1024 char buf[BUFFER_SIZE]; - // Ensure Temporary Directory - { - // Check If It Exists - struct stat tmp_stat; - int exists = stat(MCPI_LOGS_DIR, &tmp_stat) != 0 ? 0 : S_ISDIR(tmp_stat.st_mode); - if (!exists) { - // Doesn't Exist - if (mkdir(MCPI_LOGS_DIR, S_IRUSR | S_IWUSR | S_IXUSR) != 0) { - ERR("Unable To Create Temporary Folder: %s", strerror(errno)); - } - } - } - // Setup Polling int number_fds = 3; struct pollfd poll_fds[number_fds]; diff --git a/libreborn/include/libreborn/config.h.in b/libreborn/include/libreborn/config.h.in index 281ce1558..a9f82ec70 100644 --- a/libreborn/include/libreborn/config.h.in +++ b/libreborn/include/libreborn/config.h.in @@ -9,4 +9,5 @@ #cmakedefine MCPI_APP_TITLE "@MCPI_APP_TITLE@" #cmakedefine MCPI_APP_ID "@MCPI_APP_ID@" #cmakedefine MCPI_VERSION "@MCPI_VERSION@" +#cmakedefine MCPI_VARIANT_NAME "@MCPI_VARIANT_NAME@" #cmakedefine MCPI_SDK_DIR "@MCPI_SDK_DIR@"