feat: add dialog to ask whether to chaneg instance's name
This prevents custom names from being lost when updating, by only changing the name if the old instance name constains the old version, so that we can update it if the user whishes to. Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
ddde885084
commit
06019f01e3
5 changed files with 44 additions and 11 deletions
|
@ -262,12 +262,20 @@ bool ModrinthCreationTask::createInstance()
|
|||
|
||||
loop.exec();
|
||||
|
||||
// Update information of the already installed instance, if any.
|
||||
if (m_instance && ended_well) {
|
||||
setAbortable(false);
|
||||
auto inst = m_instance.value();
|
||||
|
||||
// Only change the name if it didn't use a custom name, so that the previous custom name
|
||||
// is preserved, but if we're using the original one, we update the version string.
|
||||
// NOTE: This needs to come before the copyManagedPack call!
|
||||
if (inst->name().contains(inst->getManagedPackVersionName())) {
|
||||
if (askForChangingInstanceName(m_parent, inst->name(), instance.name()) == InstanceNameChange::ShouldChange)
|
||||
inst->setName(instance.name());
|
||||
}
|
||||
|
||||
inst->copyManagedPack(instance);
|
||||
inst->setName(instance.name());
|
||||
}
|
||||
|
||||
return ended_well;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue