mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-12-04 03:45:38 +00:00
LOG: when retrodeck is defined just open the logfile in append mode and void backing up
Some checks are pending
Build ES-DE / Building_RetroDECK-ES-DE (push) Waiting to run
Some checks are pending
Build ES-DE / Building_RetroDECK-ES-DE (push) Waiting to run
This commit is contained in:
parent
fa2d75af98
commit
f64cbe8024
|
@ -42,26 +42,33 @@ void Log::init()
|
||||||
// Default to the existing location if rd_logs_folder is not defined
|
// Default to the existing location if rd_logs_folder is not defined
|
||||||
sLogPath = Utils::FileSystem::getAppDataDirectory() + "/retrodeck.log";
|
sLogPath = Utils::FileSystem::getAppDataDirectory() + "/retrodeck.log";
|
||||||
}
|
}
|
||||||
|
// Skip renaming to .bak for RetroDECK
|
||||||
#else
|
#else
|
||||||
if (Settings::getInstance()->getBool("LegacyAppDataDirectory"))
|
if (Settings::getInstance()->getBool("LegacyAppDataDirectory"))
|
||||||
sLogPath = Utils::FileSystem::getAppDataDirectory() + "/es_log.txt";
|
sLogPath = Utils::FileSystem::getAppDataDirectory() + "/es_log.txt";
|
||||||
else
|
else
|
||||||
sLogPath = Utils::FileSystem::getAppDataDirectory() + "/logs/es_log.txt";
|
sLogPath = Utils::FileSystem::getAppDataDirectory() + "/logs/es_log.txt";
|
||||||
#endif
|
|
||||||
|
|
||||||
Utils::FileSystem::removeFile(sLogPath + ".bak");
|
Utils::FileSystem::removeFile(sLogPath + ".bak");
|
||||||
// Rename the previous log file.
|
// Rename the previous log file.
|
||||||
Utils::FileSystem::renameFile(sLogPath, sLogPath + ".bak", true);
|
Utils::FileSystem::renameFile(sLogPath, sLogPath + ".bak", true);
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::open()
|
void Log::open()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock {sLogMutex};
|
std::unique_lock<std::mutex> 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)
|
#if defined(_WIN64)
|
||||||
sFile.open(Utils::String::stringToWideString(sLogPath).c_str());
|
sFile.open(Utils::String::stringToWideString(sLogPath).c_str(), mode);
|
||||||
#else
|
#else
|
||||||
sFile.open(sLogPath.c_str());
|
sFile.open(sLogPath.c_str(), mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue