Fix logging on Mac

These fixes were suggested by Sveciaost on #mac-users on Discord
This commit is contained in:
Monster Iestyn 2020-05-10 16:47:01 +01:00
parent baee6a1d57
commit 3ce4c1b789
2 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef __unix__ #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#include <errno.h> #include <errno.h>
#endif #endif
@ -142,7 +142,7 @@ int main(int argc, char **argv)
const char *reldir; const char *reldir;
int left; int left;
boolean fileabs; boolean fileabs;
#ifdef __unix__ #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
const char *link; const char *link;
#endif #endif
@ -201,7 +201,7 @@ int main(int argc, char **argv)
M_PathParts(logdir) - 1, M_PathParts(logdir) - 1,
M_PathParts(logfilename) - 1, 0755); M_PathParts(logfilename) - 1, 0755);
#ifdef __unix__ #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
logstream = fopen(logfilename, "w"); logstream = fopen(logfilename, "w");
#ifdef DEFAULTDIR #ifdef DEFAULTDIR
if (logdir) if (logdir)
@ -214,9 +214,9 @@ int main(int argc, char **argv)
{ {
I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno)); I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno));
} }
#else/*__unix__*/ #else/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
logstream = fopen("latest-log.txt", "wt+"); logstream = fopen("latest-log.txt", "wt+");
#endif/*__unix__*/ #endif/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
} }
//I_OutputMsg("I_StartupSystem() ...\n"); //I_OutputMsg("I_StartupSystem() ...\n");

View File

@ -2484,7 +2484,7 @@ void I_RemoveExitFunc(void (*func)())
} }
} }
#ifndef __unix__ #if !(defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON))
static void Shittycopyerror(const char *name) static void Shittycopyerror(const char *name)
{ {
I_OutputMsg( I_OutputMsg(
@ -2524,7 +2524,7 @@ static void Shittylogcopy(void)
Shittycopyerror(logfilename); Shittycopyerror(logfilename);
} }
} }
#endif/*__unix__*/ #endif/*!(defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON))*/
// //
// Closes down everything. This includes restoring the initial // Closes down everything. This includes restoring the initial
@ -2548,7 +2548,7 @@ void I_ShutdownSystem(void)
if (logstream) if (logstream)
{ {
I_OutputMsg("I_ShutdownSystem(): end of logstream.\n"); I_OutputMsg("I_ShutdownSystem(): end of logstream.\n");
#ifndef __unix__ #if !(defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON))
Shittylogcopy(); Shittylogcopy();
#endif #endif
fclose(logstream); fclose(logstream);