aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-09-11 13:16:25 -0300
committerflow <flowlnlnln@gmail.com>2022-09-20 18:36:10 -0300
commit06019f01e3e7b87e752ddc15deb850e272a82d21 (patch)
tree45b1e4783760902d0d771a2cf27f049b2f61493d /launcher/modplatform/flame/FlameInstanceCreationTask.cpp
parentddde885084a8eba61e691974edbc75186438ed55 (diff)
downloadPrismLauncher-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/flame/FlameInstanceCreationTask.cpp')
-rw-r--r--launcher/modplatform/flame/FlameInstanceCreationTask.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
index 1b282770..69a41e55 100644
--- a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
+++ b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
@@ -15,8 +15,8 @@
#include "settings/INISettingsObject.h"
-#include "ui/dialogs/CustomMessageBox.h"
#include "ui/dialogs/BlockedModsDialog.h"
+#include "ui/dialogs/CustomMessageBox.h"
const static QMap<QString, QString> forgemap = { { "1.2.5", "3.4.9.171" },
{ "1.4.2", "6.0.1.355" },
@@ -348,12 +348,20 @@ bool FlameCreationTask::createInstance()
bool did_succeed = getError().isEmpty();
+ // Update information of the already installed instance, if any.
if (m_instance && did_succeed) {
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 did_succeed;