Merge pull request #639 from Scrumplex/fix-prio-modpack-formats
Prefer stricter modpack formats during import
This commit is contained in:
commit
85901082a2
@ -135,18 +135,20 @@ void InstanceImportTask::processZipPack()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList blacklist = {"instance.cfg", "manifest.json"};
|
QuaZipDir packZipDir(m_packZip.get());
|
||||||
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");
|
// https://docs.modrinth.com/docs/modpacks/format_definition/#storage
|
||||||
QString flameFound = MMCZip::findFolderOfFileInZip(m_packZip.get(), "manifest.json");
|
bool modrinthFound = packZipDir.exists("/modrinth.index.json");
|
||||||
QString modrinthFound = MMCZip::findFolderOfFileInZip(m_packZip.get(), "modrinth.index.json");
|
bool technicFound = packZipDir.exists("/bin/modpack.jar") || packZipDir.exists("/bin/version.json");
|
||||||
QString root;
|
QString root;
|
||||||
if(!mmcFound.isNull())
|
|
||||||
|
// NOTE: Prioritize modpack platforms that aren't searched for recursively.
|
||||||
|
// Especially Flame has a very common filename for its manifest, which may appear inside overrides for example
|
||||||
|
if(modrinthFound)
|
||||||
{
|
{
|
||||||
// process as MultiMC instance/pack
|
// process as Modrinth pack
|
||||||
qDebug() << "MultiMC:" << mmcFound;
|
qDebug() << "Modrinth:" << modrinthFound;
|
||||||
root = mmcFound;
|
m_modpackType = ModpackType::Modrinth;
|
||||||
m_modpackType = ModpackType::MultiMC;
|
|
||||||
}
|
}
|
||||||
else if (technicFound)
|
else if (technicFound)
|
||||||
{
|
{
|
||||||
@ -156,19 +158,25 @@ void InstanceImportTask::processZipPack()
|
|||||||
extractDir.cd(".minecraft");
|
extractDir.cd(".minecraft");
|
||||||
m_modpackType = ModpackType::Technic;
|
m_modpackType = ModpackType::Technic;
|
||||||
}
|
}
|
||||||
else if(!flameFound.isNull())
|
else
|
||||||
|
{
|
||||||
|
QString mmcRoot = MMCZip::findFolderOfFileInZip(m_packZip.get(), "instance.cfg");
|
||||||
|
QString flameRoot = MMCZip::findFolderOfFileInZip(m_packZip.get(), "manifest.json");
|
||||||
|
|
||||||
|
if (!mmcRoot.isEmpty())
|
||||||
|
{
|
||||||
|
// process as MultiMC instance/pack
|
||||||
|
qDebug() << "MultiMC:" << mmcRoot;
|
||||||
|
root = mmcRoot;
|
||||||
|
m_modpackType = ModpackType::MultiMC;
|
||||||
|
}
|
||||||
|
else if(!flameRoot.isEmpty())
|
||||||
{
|
{
|
||||||
// process as Flame pack
|
// process as Flame pack
|
||||||
qDebug() << "Flame:" << flameFound;
|
qDebug() << "Flame:" << flameRoot;
|
||||||
root = flameFound;
|
root = flameRoot;
|
||||||
m_modpackType = ModpackType::Flame;
|
m_modpackType = ModpackType::Flame;
|
||||||
}
|
}
|
||||||
else if(!modrinthFound.isNull())
|
|
||||||
{
|
|
||||||
// process as Modrinth pack
|
|
||||||
qDebug() << "Modrinth:" << modrinthFound;
|
|
||||||
root = modrinthFound;
|
|
||||||
m_modpackType = ModpackType::Modrinth;
|
|
||||||
}
|
}
|
||||||
if(m_modpackType == ModpackType::Unknown)
|
if(m_modpackType == ModpackType::Unknown)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user