Qt: fix removal functions after cache compression
This commit is contained in:
@@ -1248,13 +1248,11 @@ bool game_list_frame::RemoveShadersCache(const std::string& base_dir, bool is_in
|
|||||||
u32 caches_removed = 0;
|
u32 caches_removed = 0;
|
||||||
u32 caches_total = 0;
|
u32 caches_total = 0;
|
||||||
|
|
||||||
QDirIterator dir_iter(qstr(base_dir), QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
QDirIterator dir_iter(qstr(base_dir), QStringList() << QStringLiteral("shaders_cache"), QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
while (dir_iter.hasNext())
|
while (dir_iter.hasNext())
|
||||||
{
|
{
|
||||||
const QString filepath = dir_iter.next();
|
const QString filepath = dir_iter.next();
|
||||||
|
|
||||||
if (dir_iter.fileName() == "shaders_cache")
|
|
||||||
{
|
|
||||||
if (QDir(filepath).removeRecursively())
|
if (QDir(filepath).removeRecursively())
|
||||||
{
|
{
|
||||||
++caches_removed;
|
++caches_removed;
|
||||||
@@ -1264,9 +1262,9 @@ bool game_list_frame::RemoveShadersCache(const std::string& base_dir, bool is_in
|
|||||||
{
|
{
|
||||||
LOG_WARNING(GENERAL, "Could not completely remove shaders cache dir: %s", sstr(filepath));
|
LOG_WARNING(GENERAL, "Could not completely remove shaders cache dir: %s", sstr(filepath));
|
||||||
}
|
}
|
||||||
|
|
||||||
++caches_total;
|
++caches_total;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const bool success = caches_total == caches_removed;
|
const bool success = caches_total == caches_removed;
|
||||||
|
|
||||||
@@ -1289,13 +1287,11 @@ bool game_list_frame::RemovePPUCache(const std::string& base_dir, bool is_intera
|
|||||||
u32 files_removed = 0;
|
u32 files_removed = 0;
|
||||||
u32 files_total = 0;
|
u32 files_total = 0;
|
||||||
|
|
||||||
QDirIterator dir_iter(qstr(base_dir), QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
QDirIterator dir_iter(qstr(base_dir), QStringList() << QStringLiteral("*.obj") << QStringLiteral("*.obj.gz"), QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
while (dir_iter.hasNext())
|
while (dir_iter.hasNext())
|
||||||
{
|
{
|
||||||
const QString filepath = dir_iter.next();
|
const QString filepath = dir_iter.next();
|
||||||
|
|
||||||
if (QString::compare(dir_iter.fileInfo().suffix(), QStringLiteral("obj"), Qt::CaseInsensitive) == 0)
|
|
||||||
{
|
|
||||||
if (QFile::remove(filepath))
|
if (QFile::remove(filepath))
|
||||||
{
|
{
|
||||||
++files_removed;
|
++files_removed;
|
||||||
@@ -1305,9 +1301,9 @@ bool game_list_frame::RemovePPUCache(const std::string& base_dir, bool is_intera
|
|||||||
{
|
{
|
||||||
LOG_WARNING(GENERAL, "Could not remove PPU cache file: %s", sstr(filepath));
|
LOG_WARNING(GENERAL, "Could not remove PPU cache file: %s", sstr(filepath));
|
||||||
}
|
}
|
||||||
|
|
||||||
++files_total;
|
++files_total;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const bool success = files_total == files_removed;
|
const bool success = files_total == files_removed;
|
||||||
|
|
||||||
@@ -1330,13 +1326,11 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera
|
|||||||
u32 files_removed = 0;
|
u32 files_removed = 0;
|
||||||
u32 files_total = 0;
|
u32 files_total = 0;
|
||||||
|
|
||||||
QDirIterator dir_iter(qstr(base_dir), QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
QDirIterator dir_iter(qstr(base_dir), QStringList() << QStringLiteral("*.dat") << QStringLiteral("*.dat.gz"), QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
while (dir_iter.hasNext())
|
while (dir_iter.hasNext())
|
||||||
{
|
{
|
||||||
const QString filepath = dir_iter.next();
|
const QString filepath = dir_iter.next();
|
||||||
|
|
||||||
if (QString::compare(dir_iter.fileInfo().suffix(), QStringLiteral("dat"), Qt::CaseInsensitive) == 0)
|
|
||||||
{
|
|
||||||
if (QFile::remove(filepath))
|
if (QFile::remove(filepath))
|
||||||
{
|
{
|
||||||
++files_removed;
|
++files_removed;
|
||||||
@@ -1346,9 +1340,9 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera
|
|||||||
{
|
{
|
||||||
LOG_WARNING(GENERAL, "Could not remove SPU cache file: %s", sstr(filepath));
|
LOG_WARNING(GENERAL, "Could not remove SPU cache file: %s", sstr(filepath));
|
||||||
}
|
}
|
||||||
|
|
||||||
++files_total;
|
++files_total;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const bool success = files_total == files_removed;
|
const bool success = files_total == files_removed;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user