mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 04:32:35 +01:00
Qt: remove empty cache dirs if possible
This commit is contained in:
parent
b49f8623f6
commit
2082f06443
@ -1577,8 +1577,9 @@ bool game_list_frame::RemoveShadersCache(const std::string& base_dir, bool is_in
|
|||||||
u32 caches_total = 0;
|
u32 caches_total = 0;
|
||||||
|
|
||||||
const QStringList filter{ QStringLiteral("shaders_cache") };
|
const QStringList filter{ QStringLiteral("shaders_cache") };
|
||||||
|
const QString q_base_dir = qstr(base_dir);
|
||||||
|
|
||||||
QDirIterator dir_iter(qstr(base_dir), filter, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
QDirIterator dir_iter(q_base_dir, filter, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
while (dir_iter.hasNext())
|
while (dir_iter.hasNext())
|
||||||
{
|
{
|
||||||
@ -1604,6 +1605,14 @@ bool game_list_frame::RemoveShadersCache(const std::string& base_dir, bool is_in
|
|||||||
else
|
else
|
||||||
game_list_log.fatal("Only %d/%d shaders cache dirs could be removed in %s", caches_removed, caches_total, base_dir);
|
game_list_log.fatal("Only %d/%d shaders cache dirs could be removed in %s", caches_removed, caches_total, base_dir);
|
||||||
|
|
||||||
|
if (QDir(q_base_dir).isEmpty())
|
||||||
|
{
|
||||||
|
if (fs::remove_dir(base_dir))
|
||||||
|
game_list_log.notice("Removed empty shader cache directory: %s", base_dir);
|
||||||
|
else
|
||||||
|
game_list_log.error("Could not remove empty shader cache directory: '%s' (%s)", base_dir, fs::g_tls_error);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1619,8 +1628,9 @@ bool game_list_frame::RemovePPUCache(const std::string& base_dir, bool is_intera
|
|||||||
u32 files_total = 0;
|
u32 files_total = 0;
|
||||||
|
|
||||||
const QStringList filter{ QStringLiteral("v*.obj"), QStringLiteral("v*.obj.gz") };
|
const QStringList filter{ QStringLiteral("v*.obj"), QStringLiteral("v*.obj.gz") };
|
||||||
|
const QString q_base_dir = qstr(base_dir);
|
||||||
|
|
||||||
QDirIterator dir_iter(qstr(base_dir), filter, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
QDirIterator dir_iter(q_base_dir, filter, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
while (dir_iter.hasNext())
|
while (dir_iter.hasNext())
|
||||||
{
|
{
|
||||||
@ -1646,6 +1656,14 @@ bool game_list_frame::RemovePPUCache(const std::string& base_dir, bool is_intera
|
|||||||
else
|
else
|
||||||
game_list_log.fatal("Only %d/%d PPU cache files could be removed in %s", files_removed, files_total, base_dir);
|
game_list_log.fatal("Only %d/%d PPU cache files could be removed in %s", files_removed, files_total, base_dir);
|
||||||
|
|
||||||
|
if (QDir(q_base_dir).isEmpty())
|
||||||
|
{
|
||||||
|
if (fs::remove_dir(base_dir))
|
||||||
|
game_list_log.notice("Removed empty PPU cache directory: %s", base_dir);
|
||||||
|
else
|
||||||
|
game_list_log.error("Could not remove empty PPU cache directory: '%s' (%s)", base_dir, fs::g_tls_error);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1661,8 +1679,9 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera
|
|||||||
u32 files_total = 0;
|
u32 files_total = 0;
|
||||||
|
|
||||||
const QStringList filter{ QStringLiteral("spu*.dat"), QStringLiteral("spu*.dat.gz"), QStringLiteral("spu*.obj"), QStringLiteral("spu*.obj.gz") };
|
const QStringList filter{ QStringLiteral("spu*.dat"), QStringLiteral("spu*.dat.gz"), QStringLiteral("spu*.obj"), QStringLiteral("spu*.obj.gz") };
|
||||||
|
const QString q_base_dir = qstr(base_dir);
|
||||||
|
|
||||||
QDirIterator dir_iter(qstr(base_dir), filter, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
QDirIterator dir_iter(q_base_dir, filter, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
|
|
||||||
while (dir_iter.hasNext())
|
while (dir_iter.hasNext())
|
||||||
{
|
{
|
||||||
@ -1688,6 +1707,14 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera
|
|||||||
else
|
else
|
||||||
game_list_log.fatal("Only %d/%d SPU cache files could be removed in %s", files_removed, files_total, base_dir);
|
game_list_log.fatal("Only %d/%d SPU cache files could be removed in %s", files_removed, files_total, base_dir);
|
||||||
|
|
||||||
|
if (QDir(q_base_dir).isEmpty())
|
||||||
|
{
|
||||||
|
if (fs::remove_dir(base_dir))
|
||||||
|
game_list_log.notice("Removed empty SPU cache directory: %s", base_dir);
|
||||||
|
else
|
||||||
|
game_list_log.error("Could not remove empty SPU cache directory: '%s' (%s)", base_dir, fs::g_tls_error);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1787,7 +1787,7 @@ void main_window::BootRecentAction(const QAction* act)
|
|||||||
m_rg_entries.removeAt(idx);
|
m_rg_entries.removeAt(idx);
|
||||||
m_recent_game_acts.removeAt(idx);
|
m_recent_game_acts.removeAt(idx);
|
||||||
|
|
||||||
m_gui_settings->SetValue(gui::rg_entries, m_gui_settings->List2Var(m_rg_entries));
|
m_gui_settings->SetValue(gui::rg_entries, gui_settings::List2Var(m_rg_entries));
|
||||||
|
|
||||||
gui_log.error("Recent Game not valid, removed from Boot Recent list: %s", path);
|
gui_log.error("Recent Game not valid, removed from Boot Recent list: %s", path);
|
||||||
|
|
||||||
@ -1823,7 +1823,7 @@ QAction* main_window::CreateRecentAction(const q_string_pair& entry, const uint&
|
|||||||
const int idx = m_rg_entries.indexOf(entry);
|
const int idx = m_rg_entries.indexOf(entry);
|
||||||
m_rg_entries.removeAt(idx);
|
m_rg_entries.removeAt(idx);
|
||||||
|
|
||||||
m_gui_settings->SetValue(gui::rg_entries, m_gui_settings->List2Var(m_rg_entries));
|
m_gui_settings->SetValue(gui::rg_entries, gui_settings::List2Var(m_rg_entries));
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -1910,7 +1910,7 @@ void main_window::AddRecentAction(const q_string_pair& entry)
|
|||||||
ui->bootRecentMenu->addAction(m_recent_game_acts[i]);
|
ui->bootRecentMenu->addAction(m_recent_game_acts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gui_settings->SetValue(gui::rg_entries, m_gui_settings->List2Var(m_rg_entries));
|
m_gui_settings->SetValue(gui::rg_entries, gui_settings::List2Var(m_rg_entries));
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window::UpdateLanguageActions(const QStringList& language_codes, const QString& language_code)
|
void main_window::UpdateLanguageActions(const QStringList& language_codes, const QString& language_code)
|
||||||
@ -2081,7 +2081,7 @@ void main_window::CreateConnects()
|
|||||||
ui->bootRecentMenu->removeAction(act);
|
ui->bootRecentMenu->removeAction(act);
|
||||||
}
|
}
|
||||||
m_recent_game_acts.clear();
|
m_recent_game_acts.clear();
|
||||||
m_gui_settings->SetValue(gui::rg_entries, m_gui_settings->List2Var(q_pair_list()));
|
m_gui_settings->SetValue(gui::rg_entries, gui_settings::List2Var(q_pair_list()));
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->freezeRecentAct, &QAction::triggered, this, [this](bool checked)
|
connect(ui->freezeRecentAct, &QAction::triggered, this, [this](bool checked)
|
||||||
|
Loading…
Reference in New Issue
Block a user