mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-01-08 21:44:14 +00:00
GH-4699 Set Modrinth exporter task status
This commit is contained in:
parent
01f3511e88
commit
a452b7ee96
@ -21,6 +21,8 @@ ModrinthInstanceExportTask::ModrinthInstanceExportTask(InstancePtr instance, Mod
|
|||||||
|
|
||||||
void ModrinthInstanceExportTask::executeTask()
|
void ModrinthInstanceExportTask::executeTask()
|
||||||
{
|
{
|
||||||
|
setStatus(tr("Finding files to look up on Modrinth..."));
|
||||||
|
|
||||||
QDir modsDir(m_instance->gameRoot() + "/mods");
|
QDir modsDir(m_instance->gameRoot() + "/mods");
|
||||||
modsDir.setFilter(QDir::Files);
|
modsDir.setFilter(QDir::Files);
|
||||||
modsDir.setNameFilters(QStringList() << "*.jar");
|
modsDir.setNameFilters(QStringList() << "*.jar");
|
||||||
@ -99,10 +101,12 @@ void ModrinthInstanceExportTask::executeTask()
|
|||||||
connect(m_netJob.get(), &NetJob::progress, this, &ModrinthInstanceExportTask::lookupProgress);
|
connect(m_netJob.get(), &NetJob::progress, this, &ModrinthInstanceExportTask::lookupProgress);
|
||||||
|
|
||||||
m_netJob->start();
|
m_netJob->start();
|
||||||
|
setStatus(tr("Looking up files on Modrinth..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModrinthInstanceExportTask::lookupSucceeded()
|
void ModrinthInstanceExportTask::lookupSucceeded()
|
||||||
{
|
{
|
||||||
|
setStatus(tr("Creating modpack metadata..."));
|
||||||
QList<ModrinthFile> resolvedFiles;
|
QList<ModrinthFile> resolvedFiles;
|
||||||
QFileInfoList failedFiles;
|
QFileInfoList failedFiles;
|
||||||
|
|
||||||
@ -182,6 +186,8 @@ void ModrinthInstanceExportTask::lookupSucceeded()
|
|||||||
|
|
||||||
indexJson.insert("dependencies", dependencies);
|
indexJson.insert("dependencies", dependencies);
|
||||||
|
|
||||||
|
setStatus(tr("Copying files to modpack..."));
|
||||||
|
|
||||||
QTemporaryDir tmp;
|
QTemporaryDir tmp;
|
||||||
if (tmp.isValid()) {
|
if (tmp.isValid()) {
|
||||||
Json::write(indexJson, tmp.filePath("modrinth.index.json"));
|
Json::write(indexJson, tmp.filePath("modrinth.index.json"));
|
||||||
@ -211,6 +217,7 @@ void ModrinthInstanceExportTask::lookupSucceeded()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setStatus(tr("Zipping modpack..."));
|
||||||
if (!JlCompress::compressDir(m_settings.exportPath, tmp.path())) {
|
if (!JlCompress::compressDir(m_settings.exportPath, tmp.path())) {
|
||||||
emitFailed(tr("Failed to create zip file"));
|
emitFailed(tr("Failed to create zip file"));
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user