Readd removing of unmodified cache files (#2947)

Co-authored-by: Mm2PL <mm2pl+gh@kotmisia.pl>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Tal Neoran
2021-07-03 14:40:24 +03:00
committed by GitHub
parent 8385d06369
commit 6830e8b01b
2 changed files with 6 additions and 5 deletions
+5 -5
View File
@@ -145,17 +145,17 @@ namespace {
// improved in the future.
void clearCache(const QDir &dir)
{
qCDebug(chatterinoCache) << "[Cache] cleared cache";
QStringList toBeRemoved;
int deletedCount = 0;
for (auto &&info : dir.entryInfoList(QDir::Files))
{
if (info.lastModified().addDays(14) < QDateTime::currentDateTime())
{
toBeRemoved << info.absoluteFilePath();
bool res = QFile(info.absoluteFilePath()).remove();
if (res)
++deletedCount;
}
}
qCDebug(chatterinoCache) << "Deleted" << deletedCount << "files";
}
} // namespace