From 007473c9dcee5cfa2a1a42ec2c0331f55e0f8376 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 20 May 2020 20:45:02 +1000 Subject: [PATCH] use CC_BUILD_MINFILES to disable chat/crash log code, instead of hardcoding to CC_BUILD_WEB Also avoid referencing DateTime_CurrentLocal and related code in web client now --- src/Chat.c | 2 +- src/Core.h | 1 + src/Logger.c | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Chat.c b/src/Chat.c index 45a483d13..11ebac318 100644 --- a/src/Chat.c +++ b/src/Chat.c @@ -46,7 +46,7 @@ static void AppendChatLogTime(void) { Chat_LogTime[logTimesCount++] = now; } -#ifdef CC_BUILD_WEB +#ifdef CC_BUILD_MINFILES static void ResetLogFile(void) { } static void CloseLogFile(void) { } void Chat_SetLogName(const String* name) { } diff --git a/src/Core.h b/src/Core.h index 866e46ae9..b18f50e20 100644 --- a/src/Core.h +++ b/src/Core.h @@ -222,6 +222,7 @@ typedef struct TextureRec_ { float U1, V1, U2, V2; } TextureRec; #define CC_BUILD_GLES #define CC_BUILD_TOUCH #define CC_BUILD_NOAUDIO +#define CC_BUILD_MINFILES #endif #endif diff --git a/src/Logger.c b/src/Logger.c index 449d27a21..debb73b97 100644 --- a/src/Logger.c +++ b/src/Logger.c @@ -824,8 +824,11 @@ void Logger_Abort2(cc_result result, const char* raw_msg) { static struct Stream logStream; static cc_bool logOpen; +#ifdef CC_BUILD_MINFILES +void Logger_Log(const String* msg) { } +static void Logger_LogCrashHeader(void) { } +#else void Logger_Log(const String* msg) { -#ifndef CC_BUILD_WEB static const String path = String_FromConst("client.log"); if (!logOpen) { logOpen = true; @@ -834,7 +837,6 @@ void Logger_Log(const String* msg) { if (!logStream.Meta.File) return; Stream_Write(&logStream, (const cc_uint8*)msg->buffer, msg->length); -#endif } static void Logger_LogCrashHeader(void) { @@ -851,6 +853,7 @@ static void Logger_LogCrashHeader(void) { String_Format3(&msg, "%p2:%p2:%p2" _NL, &now.hour, &now.minute, &now.second); Logger_Log(&msg); } +#endif static void Logger_AbortCommon(cc_result result, const char* raw_msg, void* ctx) { String msg; char msgBuffer[3070 + 1];