mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
impr: Properly delete old update files
This commit is contained in:
@@ -210,7 +210,7 @@ namespace hex::init {
|
||||
if (files.size() <= count)
|
||||
return;
|
||||
|
||||
std::sort(files.begin(), files.end(), [](const auto& a, const auto& b) {
|
||||
std::ranges::sort(files, [](const auto& a, const auto& b) {
|
||||
return std::filesystem::last_write_time(a) > std::filesystem::last_write_time(b);
|
||||
});
|
||||
|
||||
@@ -226,6 +226,13 @@ namespace hex::init {
|
||||
keepNewest(10, paths::Logs);
|
||||
keepNewest(25, paths::Backups);
|
||||
|
||||
// Remove all old update files
|
||||
for (const auto &path : paths::Updates.all()) {
|
||||
for (const auto &entry : std::filesystem::directory_iterator(path)) {
|
||||
wolv::io::fs::removeAll(entry.path());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user