fix duplicate optional mods dialog appearing when updating a modpack
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com> tmp
This commit is contained in:
parent
79180db663
commit
59a816c696
2 changed files with 33 additions and 16 deletions
|
@ -227,6 +227,11 @@ bool FlameCreationTask::updateInstance()
|
||||||
QString relative_path(FS::PathCombine(file.targetFolder, file.version.fileName));
|
QString relative_path(FS::PathCombine(file.targetFolder, file.version.fileName));
|
||||||
qDebug() << "Scheduling" << relative_path << "for removal";
|
qDebug() << "Scheduling" << relative_path << "for removal";
|
||||||
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(relative_path));
|
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(relative_path));
|
||||||
|
if (relative_path.endsWith(".disabled")) { // remove it if it was enabled/disabled by user
|
||||||
|
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(relative_path.chopped(9)));
|
||||||
|
} else {
|
||||||
|
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(relative_path + ".disabled"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(job.get(), &Task::failed, this, [](QString reason) { qCritical() << "Failed to get files: " << reason; });
|
connect(job.get(), &Task::failed, this, [](QString reason) { qCritical() << "Failed to get files: " << reason; });
|
||||||
|
|
|
@ -121,6 +121,11 @@ bool ModrinthCreationTask::updateInstance()
|
||||||
continue;
|
continue;
|
||||||
qDebug() << "Scheduling" << file.path << "for removal";
|
qDebug() << "Scheduling" << file.path << "for removal";
|
||||||
m_files_to_remove.append(old_minecraft_dir.absoluteFilePath(file.path));
|
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"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,23 +421,30 @@ bool ModrinthCreationTask::parseManifest(const QString& index_path,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!optionalFiles.empty()) {
|
if (!optionalFiles.empty()) {
|
||||||
QStringList oFiles;
|
if (show_optional_dialog) {
|
||||||
for (auto file : optionalFiles)
|
QStringList oFiles;
|
||||||
oFiles.push_back(file.path);
|
for (auto file : optionalFiles)
|
||||||
OptionalModDialog optionalModDialog(m_parent, oFiles);
|
oFiles.push_back(file.path);
|
||||||
if (optionalModDialog.exec() == QDialog::Rejected) {
|
OptionalModDialog optionalModDialog(m_parent, oFiles);
|
||||||
emitAborted();
|
if (optionalModDialog.exec() == QDialog::Rejected) {
|
||||||
return false;
|
emitAborted();
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
auto selectedMods = optionalModDialog.getResult();
|
|
||||||
for (auto file : optionalFiles) {
|
auto selectedMods = optionalModDialog.getResult();
|
||||||
if (selectedMods.contains(file.path)) {
|
for (auto file : optionalFiles) {
|
||||||
file.required = true;
|
if (selectedMods.contains(file.path)) {
|
||||||
} else {
|
file.required = true;
|
||||||
file.path += ".disabled";
|
} else {
|
||||||
|
file.path += ".disabled";
|
||||||
|
}
|
||||||
|
files.push_back(file);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (auto file : optionalFiles) {
|
||||||
|
file.path += ".disabled";
|
||||||
|
files.push_back(file);
|
||||||
}
|
}
|
||||||
files.push_back(file);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (set_internal_data) {
|
if (set_internal_data) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue