From f5972b68c29ec63ee3afea983cf8faa5c21db221 Mon Sep 17 00:00:00 2001 From: Keksilton <13134670+Keksilton@users.noreply.github.com> Date: Wed, 20 May 2026 08:09:49 -0400 Subject: [PATCH] Perform modpack type detection as needed --- launcher/InstanceImportTask.cpp | 37 ++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp index ca87b76324..42834e7cf7 100644 --- a/launcher/InstanceImportTask.cpp +++ b/launcher/InstanceImportTask.cpp @@ -102,30 +102,37 @@ void InstanceImportTask::processZipPack() QStringList blacklist = {"instance.cfg", "manifest.json"}; QString mmcFound = MMCZip::findFolderOfFileInZip(m_packZip.get(), "instance.cfg"); - bool technicFound = QuaZipDir(m_packZip.get()).exists("/bin/modpack.jar") || QuaZipDir(m_packZip.get()).exists("/bin/version.json"); - QString modrinthFound = MMCZip::findFolderOfFileInZip(m_packZip.get(), "modrinth.index.json"); + QString root; - if(!mmcFound.isNull()) + if (!mmcFound.isNull()) { // process as MultiMC instance/pack qDebug() << "MultiMC:" << mmcFound; root = mmcFound; m_modpackType = ModpackType::MultiMC; } - else if (technicFound) - { - // process as Technic pack - qDebug() << "Technic:" << technicFound; - extractDir.mkpath(".minecraft"); - extractDir.cd(".minecraft"); - m_modpackType = ModpackType::Technic; + if (m_modpackType == ModpackType::Unknown) { + bool technicFound = QuaZipDir(m_packZip.get()).exists("/bin/modpack.jar") || QuaZipDir(m_packZip.get()).exists("/bin/version.json"); + if (technicFound) + { + // process as Technic pack + qDebug() << "Technic:" << technicFound; + extractDir.mkpath(".minecraft"); + extractDir.cd(".minecraft"); + m_modpackType = ModpackType::Technic; + } } - else if(!modrinthFound.isNull()) + if (m_modpackType == ModpackType::Unknown) { - // process as Modrinth pack - qDebug() << "Modrinth:" << modrinthFound; - root = modrinthFound; - m_modpackType = ModpackType::Modrinth; + QString modrinthFound = MMCZip::findFolderOfFileInZip(m_packZip.get(), "modrinth.index.json"); + + if(!modrinthFound.isNull()) + { + // process as Modrinth pack + qDebug() << "Modrinth:" << modrinthFound; + root = modrinthFound; + m_modpackType = ModpackType::Modrinth; + } } if(m_modpackType == ModpackType::Unknown) {