Move Code Around

master
TheBrokenRail 2 months ago
parent 81aa01daf9
commit 5d65b4092f
  1. 2
      dependencies/zenity/src
  2. 28
      launcher/src/crash-report.c
  3. 1
      libreborn/include/libreborn/config.h.in

@ -1 +1 @@
Subproject commit 58787016ce6f72bdc4dff75721c8936779f6c20c
Subproject commit c9ff7f17aa81d9d1566d426c87a184831ce4f7d9

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

@ -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@"

Loading…
Cancel
Save