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>
#endif
#ifdef __unix__
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
#include <errno.h>
#endif
@ -142,7 +142,7 @@ int main(int argc, char **argv)
const char *reldir;
int left;
boolean fileabs;
#ifdef __unix__
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
const char *link;
#endif
@ -201,7 +201,7 @@ int main(int argc, char **argv)
M_PathParts(logdir) - 1,
M_PathParts(logfilename) - 1, 0755);
#ifdef __unix__
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
logstream = fopen(logfilename, "w");
#ifdef DEFAULTDIR
if (logdir)
@ -214,9 +214,9 @@ int main(int argc, char **argv)
{
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+");
#endif/*__unix__*/
#endif/*defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)*/
}
//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)
{
I_OutputMsg(
@ -2524,7 +2524,7 @@ static void Shittylogcopy(void)
Shittycopyerror(logfilename);
}
}
#endif/*__unix__*/
#endif/*!(defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON))*/
//
// Closes down everything. This includes restoring the initial
@ -2548,7 +2548,7 @@ void I_ShutdownSystem(void)
if (logstream)
{
I_OutputMsg("I_ShutdownSystem(): end of logstream.\n");
#ifndef __unix__
#if !(defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON))
Shittylogcopy();
#endif
fclose(logstream);