From f64cbe8024491298e4bc7e942be0774097e6b805 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Sat, 30 Nov 2024 21:18:51 +0900 Subject: [PATCH] LOG: when retrodeck is defined just open the logfile in append mode and void backing up --- es-core/src/Log.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/es-core/src/Log.cpp b/es-core/src/Log.cpp index cadaab9a8..9393fef86 100644 --- a/es-core/src/Log.cpp +++ b/es-core/src/Log.cpp @@ -42,26 +42,33 @@ void Log::init() // Default to the existing location if rd_logs_folder is not defined sLogPath = Utils::FileSystem::getAppDataDirectory() + "/retrodeck.log"; } + // Skip renaming to .bak for RetroDECK #else if (Settings::getInstance()->getBool("LegacyAppDataDirectory")) sLogPath = Utils::FileSystem::getAppDataDirectory() + "/es_log.txt"; else sLogPath = Utils::FileSystem::getAppDataDirectory() + "/logs/es_log.txt"; -#endif Utils::FileSystem::removeFile(sLogPath + ".bak"); // Rename the previous log file. Utils::FileSystem::renameFile(sLogPath, sLogPath + ".bak", true); return; +#endif } void Log::open() { std::unique_lock lock {sLogMutex}; + + std::ios_base::openmode mode = std::ios::out; +#if defined(RETRODECK) + mode |= std::ios::app; // Append to the log file if RetroDECK is defined +#endif + #if defined(_WIN64) - sFile.open(Utils::String::stringToWideString(sLogPath).c_str()); + sFile.open(Utils::String::stringToWideString(sLogPath).c_str(), mode); #else - sFile.open(sLogPath.c_str()); + sFile.open(sLogPath.c_str(), mode); #endif }