mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-24 00:25:06 +00:00
Clean up old log files if more than 10 exist
This commit is contained in:
parent
7073dd26de
commit
8cf6a8bc98
1 changed files with 9 additions and 0 deletions
|
@ -326,6 +326,15 @@ int main(int argc, char *argv[])
|
|||
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
|
||||
#endif
|
||||
|
||||
#ifdef LOG_TO_FILE
|
||||
// Prune the oldest existing logs if there are more than 10
|
||||
QStringList existingLogNames = tempDir.entryList(QStringList("Moonlight-*.log"), QDir::NoFilter, QDir::SortFlag::Time);
|
||||
for (int i = 10; i < existingLogNames.size(); i++) {
|
||||
qInfo() << "Removing old log file:" << existingLogNames.at(i);
|
||||
QFile(tempDir.filePath(existingLogNames.at(i))).remove();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
// Force AntiHooking.dll to be statically imported and loaded
|
||||
// by ntdll on Win32 platforms by calling a dummy function.
|
||||
|
|
Loading…
Reference in a new issue