From 47e2e6f71836e20d89040e55e5dcf5ba8cc5fd81 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 11 Mar 2013 02:27:28 -0700 Subject: [PATCH] Retain the first directory level in logging. --- Common/LogManager.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index 3b0d6d0974..421a37c1d2 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -172,13 +172,21 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char formattedTime[13]; Common::Timer::GetTimeFormatted(formattedTime); +#ifdef _DEBUG #ifdef _WIN32 - const char *fileshort = strrchr(file, '\\'); + static const char sep = '\\'; #else - const char *fileshort = strrchr(file, '/'); + static const char sep = '/'; +#endif + const char *fileshort = strrchr(file, sep); + if (fileshort != NULL) { + do + --fileshort; + while (fileshort > file && *fileshort != sep); + if (fileshort != file) + file = fileshort + 1; + } #endif - if (fileshort != NULL) - file = fileshort + 1; char *msgPos = msg; if (hleCurrentThreadName != NULL)