aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-07-14 16:13:23 -0300
committerflow <flowlnlnln@gmail.com>2022-09-20 18:36:08 -0300
commit6131346e2f80c5ce4377fcc608be4f3929f43f91 (patch)
tree6fda9abad9995472ea58f819650768d9f5ff78df /launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
parenteed73c90785ec977ee975d403270f9138aa6960c (diff)
downloadPrismLauncher-6131346e2f80c5ce4377fcc608be4f3929f43f91.tar.gz
PrismLauncher-6131346e2f80c5ce4377fcc608be4f3929f43f91.tar.bz2
PrismLauncher-6131346e2f80c5ce4377fcc608be4f3929f43f91.zip
refactor: change the way instance names are handled
While working on pack updating, instance naming always gets in the way, since we need both way of respecting the user's name choice, and a standarized way of getting the original pack name / version. This tries to circunvent such problems by abstracting away the naming schema into it's own struct, holding both the original name / version, and the user-defined name, so that everyone can be happy and world peace can be achieved! (at least that's what i'd hope :c). Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp')
-rw-r--r--launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
index efb8c99b..06ac29c3 100644
--- a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
+++ b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
@@ -8,8 +8,6 @@
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
-#include "modplatform/ModIndex.h"
-
#include "net/ChecksumValidator.h"
#include "settings/INISettingsObject.h"
@@ -30,11 +28,10 @@ bool ModrinthCreationTask::updateInstance()
auto instance_list = APPLICATION->instances();
// FIXME: How to handle situations when there's more than one install already for a given modpack?
- // Based on the way we create the instance name (name + " " + version). Is there a better way?
- auto inst = instance_list->getInstanceByManagedName(m_instName.section(' ', 0, -2));
+ auto inst = instance_list->getInstanceByManagedName(originalName());
if (!inst) {
- inst = instance_list->getInstanceById(m_instName);
+ inst = instance_list->getInstanceById(originalName());
if (!inst)
return false;
@@ -163,8 +160,9 @@ bool ModrinthCreationTask::createInstance()
} else {
instance.setIconKey("modrinth");
}
- instance.setName(m_instName);
+
instance.setManagedPack("modrinth", getManagedPackID(), m_managed_name, m_managed_id, {});
+ instance.setName(name());
instance.saveNow();
m_files_job = new NetJob(tr("Mod download"), APPLICATION->network());