NOISSUE handle 'folder' Flame packages by ignoring them, show warnings for minor Flame import problems
This commit is contained in:
parent
5937b1c3d4
commit
58ead6a1f4
@ -373,6 +373,10 @@ protected:
|
||||
{
|
||||
m_child->start();
|
||||
}
|
||||
QStringList warnings() const override
|
||||
{
|
||||
return m_child->warnings();
|
||||
}
|
||||
|
||||
private slots:
|
||||
void childSucceded()
|
||||
|
@ -150,7 +150,7 @@ void InstanceImportTask::extractFinished()
|
||||
{
|
||||
if(!QFile::setPermissions(filepath, permissions))
|
||||
{
|
||||
qWarning() << "Could not fix" << filepath;
|
||||
logWarning(tr("Could not fix permissions for %1").arg(filepath));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -213,7 +213,7 @@ void InstanceImportTask::processFlame()
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "The specified overrides folder is missing. Maybe the modpack was already used before?";
|
||||
logWarning(tr("The specified overrides folder (%1) is missing. Maybe the modpack was already used before?").arg(pack.overrides));
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ void InstanceImportTask::processFlame()
|
||||
forgeVersion = id;
|
||||
continue;
|
||||
}
|
||||
qWarning() << "Unknown mod loader in manifest:" << id;
|
||||
logWarning(tr("Unknown mod loader in manifest: %1").arg(id));
|
||||
}
|
||||
|
||||
QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg");
|
||||
@ -240,7 +240,7 @@ void InstanceImportTask::processFlame()
|
||||
if(mcVersion.endsWith('.'))
|
||||
{
|
||||
mcVersion.remove(QRegExp("[.]+$"));
|
||||
qWarning() << "Mysterious trailing dots removed from Minecraft version while importing pack.";
|
||||
logWarning(tr("Mysterious trailing dots removed from Minecraft version while importing pack."));
|
||||
}
|
||||
auto components = instance.getComponentList();
|
||||
components->buildingFromScratch();
|
||||
@ -256,7 +256,7 @@ void InstanceImportTask::processFlame()
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "Could not map recommended forge version for" << mcVersion;
|
||||
logWarning(tr("Could not map recommended forge version for Minecraft %1").arg(mcVersion));
|
||||
}
|
||||
}
|
||||
components->setComponentVersion("net.minecraftforge", forgeVersion);
|
||||
@ -313,9 +313,33 @@ void InstanceImportTask::processFlame()
|
||||
{
|
||||
filename += ".disabled";
|
||||
}
|
||||
auto path = FS::PathCombine(m_stagingPath ,"minecraft", result.targetFolder, filename);
|
||||
|
||||
auto relpath = FS::PathCombine("minecraft", result.targetFolder, filename);
|
||||
auto path = FS::PathCombine(m_stagingPath , relpath);
|
||||
|
||||
switch(result.type)
|
||||
{
|
||||
case Flame::File::Type::Folder:
|
||||
{
|
||||
logWarning(tr("This 'Folder' may need extracting: %1").arg(relpath));
|
||||
// fall-through intentional, we treat these as plain old mods and dump them wherever.
|
||||
}
|
||||
case Flame::File::Type::SingleFile:
|
||||
case Flame::File::Type::Mod:
|
||||
{
|
||||
auto dl = Net::Download::makeFile(result.url, path);
|
||||
m_filesNetJob->addNetAction(dl);
|
||||
break;
|
||||
}
|
||||
case Flame::File::Type::Modpack:
|
||||
logWarning(tr("Nesting modpacks in modpacks is not implemented, nothing was downloaded: %1").arg(relpath));
|
||||
break;
|
||||
case Flame::File::Type::Cmod2:
|
||||
case Flame::File::Type::Ctoc:
|
||||
case Flame::File::Type::Unknown:
|
||||
logWarning(tr("Unrecognized/unhandled PackageType for: %1").arg(relpath));
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_modIdResolver.reset();
|
||||
connect(m_filesNetJob.get(), &NetJob::succeeded, this, [&]()
|
||||
|
@ -59,8 +59,6 @@ void Flame::FileResolvingTask::netJobFinished()
|
||||
{
|
||||
out.type = File::Type::SingleFile;
|
||||
}
|
||||
// FIXME: what are these?
|
||||
/*
|
||||
else if(strType == "ctoc")
|
||||
{
|
||||
out.type = File::Type::Ctoc;
|
||||
@ -69,13 +67,10 @@ void Flame::FileResolvingTask::netJobFinished()
|
||||
{
|
||||
out.type = File::Type::Cmod2;
|
||||
}
|
||||
*/
|
||||
else if(strType == "mod")
|
||||
{
|
||||
out.type = File::Type::Mod;
|
||||
}
|
||||
// FIXME: how to handle nested packs and folders?
|
||||
/*
|
||||
else if(strType == "folder")
|
||||
{
|
||||
out.type = File::Type::Folder;
|
||||
@ -84,7 +79,6 @@ void Flame::FileResolvingTask::netJobFinished()
|
||||
{
|
||||
out.type = File::Type::Modpack;
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
qCritical() << "Resolving of" << out.projectId << out.fileId << "failed because of unknown file type:" << strType;
|
||||
|
@ -134,3 +134,13 @@ QString Task::failReason() const
|
||||
return m_failReason;
|
||||
}
|
||||
|
||||
void Task::logWarning(const QString& line)
|
||||
{
|
||||
qWarning() << line;
|
||||
m_Warnings.append(line);
|
||||
}
|
||||
|
||||
QStringList Task::warnings() const
|
||||
{
|
||||
return m_Warnings;
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
*/
|
||||
QString failReason() const;
|
||||
|
||||
virtual QStringList warnings() const;
|
||||
|
||||
virtual bool canAbort() const { return false; }
|
||||
|
||||
QString getStatus()
|
||||
@ -54,6 +56,9 @@ public:
|
||||
return m_progressTotal;
|
||||
}
|
||||
|
||||
protected:
|
||||
void logWarning(const QString & line);
|
||||
|
||||
private:
|
||||
QString describe();
|
||||
|
||||
@ -85,6 +90,7 @@ private:
|
||||
bool m_running = false;
|
||||
bool m_finished = false;
|
||||
bool m_succeeded = false;
|
||||
QStringList m_Warnings;
|
||||
QString m_failReason = "";
|
||||
QString m_status;
|
||||
int m_progress = 0;
|
||||
|
@ -1239,7 +1239,11 @@ void MainWindow::runModalTask(Task *task)
|
||||
{
|
||||
connect(task, &Task::failed, [this](QString reason)
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Warning)->show();
|
||||
CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
|
||||
});
|
||||
connect(task, &Task::succeeded, [this, task]()
|
||||
{
|
||||
CustomMessageBox::selectable(this, tr("Warnings"), task->warnings().join('\n'), QMessageBox::Warning)->show();
|
||||
});
|
||||
ProgressDialog loadDialog(this);
|
||||
loadDialog.setSkipButton(true, tr("Abort"));
|
||||
|
Loading…
Reference in New Issue
Block a user