mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-01 07:04:32 +02:00
Add Popup for metacache clear failures (#3586)
This commit is contained in:
commit
c622c83930
@ -166,8 +166,10 @@ auto HttpMetaCache::evictEntry(MetaEntryPtr entry) -> bool
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpMetaCache::evictAll()
|
//returns true on success, false otherwise
|
||||||
|
auto HttpMetaCache::evictAll() -> bool
|
||||||
{
|
{
|
||||||
|
bool ret = true;
|
||||||
for (QString& base : m_entries.keys()) {
|
for (QString& base : m_entries.keys()) {
|
||||||
EntryMap& map = m_entries[base];
|
EntryMap& map = m_entries[base];
|
||||||
qCDebug(taskHttpMetaCacheLogC) << "Evicting base" << base;
|
qCDebug(taskHttpMetaCacheLogC) << "Evicting base" << base;
|
||||||
@ -176,8 +178,10 @@ void HttpMetaCache::evictAll()
|
|||||||
qCWarning(taskHttpMetaCacheLogC) << "Unexpected missing cache entry" << entry->m_basePath;
|
qCWarning(taskHttpMetaCacheLogC) << "Unexpected missing cache entry" << entry->m_basePath;
|
||||||
}
|
}
|
||||||
map.entry_list.clear();
|
map.entry_list.clear();
|
||||||
FS::deletePath(map.base_path);
|
//AND all return codes together so the result is true iff all runs of deletePath() are true
|
||||||
|
ret &= FS::deletePath(map.base_path);
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto HttpMetaCache::staleEntry(QString base, QString resource_path) -> MetaEntryPtr
|
auto HttpMetaCache::staleEntry(QString base, QString resource_path) -> MetaEntryPtr
|
||||||
|
@ -113,7 +113,7 @@ class HttpMetaCache : public QObject {
|
|||||||
|
|
||||||
// evict selected entry from cache
|
// evict selected entry from cache
|
||||||
auto evictEntry(MetaEntryPtr entry) -> bool;
|
auto evictEntry(MetaEntryPtr entry) -> bool;
|
||||||
void evictAll();
|
bool evictAll();
|
||||||
|
|
||||||
void addBase(QString base, QString base_root);
|
void addBase(QString base, QString base_root);
|
||||||
|
|
||||||
|
@ -1318,7 +1318,15 @@ void MainWindow::on_actionReportBug_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionClearMetadata_triggered()
|
void MainWindow::on_actionClearMetadata_triggered()
|
||||||
{
|
{
|
||||||
APPLICATION->metacache()->evictAll();
|
//This if contains side effects!
|
||||||
|
if (!APPLICATION->metacache()->evictAll()) {
|
||||||
|
CustomMessageBox::selectable(this, tr("Error"),
|
||||||
|
tr("Metadata cache clear Failed!\nTo clear the metadata cache manually, press Folders -> View "
|
||||||
|
"Launcher Root Folder, and after closing the launcher delete the folder named \"meta\"\n"),
|
||||||
|
QMessageBox::Warning)
|
||||||
|
->show();
|
||||||
|
}
|
||||||
|
|
||||||
APPLICATION->metacache()->SaveNow();
|
APPLICATION->metacache()->SaveNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user