diff --git a/CHANGELOG.md b/CHANGELOG.md index e7b7da54f..adc85c9ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Minor: Channel name in ` has gone offline. Exiting host mode.` messages is now clickable. (#2922) - Minor: Added `/openurl` command. Usage: `/openurl `. Opens the provided URL in the browser. (#2461, #2926) +- Bugfix: Now deleting cache files that weren't modified in the past 14 days. (#2947) - Bugfix: Fixed large timeout durations in moderation buttons overlapping with usernames or other buttons. (#2865, #2921) - Bugfix: Fix bad behavior of the HTML color picker edit when user input is being entered. (#2942) diff --git a/src/RunGui.cpp b/src/RunGui.cpp index 6ce6efa68..998c726b6 100644 --- a/src/RunGui.cpp +++ b/src/RunGui.cpp @@ -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