diff options
author | flow <flowlnlnln@gmail.com> | 2022-09-11 13:16:25 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-09-20 18:36:10 -0300 |
commit | 06019f01e3e7b87e752ddc15deb850e272a82d21 (patch) | |
tree | 45b1e4783760902d0d771a2cf27f049b2f61493d /launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp | |
parent | ddde885084a8eba61e691974edbc75186438ed55 (diff) | |
download | PrismLauncher-06019f01e3e7b87e752ddc15deb850e272a82d21.tar.gz PrismLauncher-06019f01e3e7b87e752ddc15deb850e272a82d21.tar.bz2 PrismLauncher-06019f01e3e7b87e752ddc15deb850e272a82d21.zip |
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>
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp')
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp index c1898dd9..2cb6e786 100644 --- a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp +++ b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp @@ -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; |