ask user if he wants to delete saves on modpack update

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2026-01-04 03:09:12 +02:00
parent 437242169d
commit 0b26d24c9b
No known key found for this signature in database
GPG key ID: 55EF5DA53DB36318
6 changed files with 48 additions and 30 deletions

View file

@ -115,15 +115,7 @@ bool ModrinthCreationTask::updateInstance()
// so we're fine removing them!
if (!old_files.empty()) {
for (auto const& file : old_files) {
if (file.path.isEmpty())
continue;
qDebug() << "Scheduling" << file.path << "for removal";
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(file.path));
if (file.path.endsWith(".disabled")) { // remove it if it was enabled/disabled by user
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(file.path.chopped(9)));
} else {
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(file.path + ".disabled"));
}
scheduleToDelete(m_parent, old_minecraft_dir, file.path, true);
}
}
@ -132,18 +124,12 @@ bool ModrinthCreationTask::updateInstance()
// FIXME: We may want to do something about disabled mods.
auto old_overrides = Override::readOverrides("overrides", old_index_folder);
for (const auto& entry : old_overrides) {
if (entry.isEmpty())
continue;
qDebug() << "Scheduling" << entry << "for removal";
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(entry));
scheduleToDelete(m_parent, old_minecraft_dir, entry);
}
auto old_client_overrides = Override::readOverrides("client-overrides", old_index_folder);
for (const auto& entry : old_client_overrides) {
if (entry.isEmpty())
continue;
qDebug() << "Scheduling" << entry << "for removal";
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(entry));
scheduleToDelete(m_parent, old_minecraft_dir, entry);
}
} else {
// We don't have an old index file, so we may duplicate stuff!