fix: show warning in case there's no old index when updating

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-08-21 10:00:23 -03:00
parent be8c6f218c
commit ddde885084
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
2 changed files with 22 additions and 0 deletions

View File

@ -195,6 +195,17 @@ bool FlameCreationTask::updateInstance()
loop.exec();
m_process_update_file_info_job = nullptr;
} else {
// We don't have an old index file, so we may duplicate stuff!
auto dialog = CustomMessageBox::selectable(m_parent,
tr("No index file."),
tr("We couldn't find a suitable index file for the older version. This may cause some of the files to be duplicated. Do you want to continue?"),
QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Cancel);
if (dialog->exec() == QDialog::DialogCode::Rejected) {
m_abort = true;
return false;
}
}
setOverride(true);

View File

@ -135,6 +135,17 @@ bool ModrinthCreationTask::updateInstance()
qDebug() << "Scheduling" << entry << "for removal";
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(entry));
}
} else {
// We don't have an old index file, so we may duplicate stuff!
auto dialog = CustomMessageBox::selectable(m_parent,
tr("No index file."),
tr("We couldn't find a suitable index file for the older version. This may cause some of the files to be duplicated. Do you want to continue?"),
QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Cancel);
if (dialog->exec() == QDialog::DialogCode::Rejected) {
m_abort = true;
return false;
}
}