summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/onesix
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-07-07 19:46:56 +0200
committerPetr Mrázek <peterix@gmail.com>2017-07-07 19:46:56 +0200
commite5b4b5d2954d72f0323ced8e7d14f5ce9606e4cb (patch)
tree5baef66192a4d73fbee3ff9652e55b121882ec76 /api/logic/minecraft/onesix
parentfbeceaa98cc252c671ef6a9d26837973cc9bffa3 (diff)
downloadMultiMC-e5b4b5d2954d72f0323ced8e7d14f5ce9606e4cb.tar
MultiMC-e5b4b5d2954d72f0323ced8e7d14f5ce9606e4cb.tar.gz
MultiMC-e5b4b5d2954d72f0323ced8e7d14f5ce9606e4cb.tar.lz
MultiMC-e5b4b5d2954d72f0323ced8e7d14f5ce9606e4cb.tar.xz
MultiMC-e5b4b5d2954d72f0323ced8e7d14f5ce9606e4cb.zip
GH-1927 Add more specific task status logging
* Tasks are now described by class name and object name (or memory address). * Tasks starts are logged. * Aborted tasks are now treated just as the other cases.
Diffstat (limited to 'api/logic/minecraft/onesix')
-rw-r--r--api/logic/minecraft/onesix/OneSixInstance.cpp75
-rw-r--r--api/logic/minecraft/onesix/OneSixUpdate.cpp10
-rw-r--r--api/logic/minecraft/onesix/update/AssetUpdateTask.h1
-rw-r--r--api/logic/minecraft/onesix/update/FMLLibrariesTask.h1
-rw-r--r--api/logic/minecraft/onesix/update/FoldersTask.cpp1
-rw-r--r--api/logic/minecraft/onesix/update/FoldersTask.h1
-rw-r--r--api/logic/minecraft/onesix/update/LibrariesTask.h1
7 files changed, 54 insertions, 36 deletions
diff --git a/api/logic/minecraft/onesix/OneSixInstance.cpp b/api/logic/minecraft/onesix/OneSixInstance.cpp
index ecfd0647..107da04f 100644
--- a/api/logic/minecraft/onesix/OneSixInstance.cpp
+++ b/api/logic/minecraft/onesix/OneSixInstance.cpp
@@ -368,53 +368,54 @@ std::shared_ptr<LaunchStep> OneSixInstance::createMainLaunchStep(LaunchTask * pa
return nullptr;
}
-
-std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
+class JarModTask : public Task
{
- class JarModTask : public Task
+ Q_OBJECT
+public:
+ explicit JarModTask(std::shared_ptr<OneSixInstance> inst) : Task(nullptr), m_inst(inst)
+ {
+ }
+ virtual void executeTask()
{
- public:
- explicit JarModTask(std::shared_ptr<OneSixInstance> inst) : Task(nullptr), m_inst(inst)
+ auto profile = m_inst->getMinecraftProfile();
+ // nuke obsolete stripped jar(s) if needed
+ QString version_id = profile->getMinecraftVersion();
+ if(!FS::ensureFolderPathExists(m_inst->binRoot()))
{
+ emitFailed(tr("Couldn't create the bin folder for Minecraft.jar"));
}
- virtual void executeTask()
+ auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar");
+ QFile finalJar(finalJarPath);
+ if(finalJar.exists())
{
- auto profile = m_inst->getMinecraftProfile();
- // nuke obsolete stripped jar(s) if needed
- QString version_id = profile->getMinecraftVersion();
- if(!FS::ensureFolderPathExists(m_inst->binRoot()))
+ if(!finalJar.remove())
{
- emitFailed(tr("Couldn't create the bin folder for Minecraft.jar"));
- }
- auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar");
- QFile finalJar(finalJarPath);
- if(finalJar.exists())
- {
- if(!finalJar.remove())
- {
- emitFailed(tr("Couldn't remove stale jar file: %1").arg(finalJarPath));
- return;
- }
+ emitFailed(tr("Couldn't remove stale jar file: %1").arg(finalJarPath));
+ return;
}
+ }
- // create temporary modded jar, if needed
- auto jarMods = m_inst->getJarMods();
- if(jarMods.size())
+ // create temporary modded jar, if needed
+ auto jarMods = m_inst->getJarMods();
+ if(jarMods.size())
+ {
+ auto mainJar = profile->getMainJar();
+ QStringList jars, temp1, temp2, temp3, temp4;
+ mainJar->getApplicableFiles(currentSystem, jars, temp1, temp2, temp3, m_inst->getLocalLibraryPath());
+ auto sourceJarPath = jars[0];
+ if(!MMCZip::createModdedJar(sourceJarPath, finalJarPath, jarMods))
{
- auto mainJar = profile->getMainJar();
- QStringList jars, temp1, temp2, temp3, temp4;
- mainJar->getApplicableFiles(currentSystem, jars, temp1, temp2, temp3, m_inst->getLocalLibraryPath());
- auto sourceJarPath = jars[0];
- if(!MMCZip::createModdedJar(sourceJarPath, finalJarPath, jarMods))
- {
- emitFailed(tr("Failed to create the custom Minecraft jar file."));
- return;
- }
+ emitFailed(tr("Failed to create the custom Minecraft jar file."));
+ return;
}
- emitSucceeded();
}
- std::shared_ptr<OneSixInstance> m_inst;
- };
+ emitSucceeded();
+ }
+ std::shared_ptr<OneSixInstance> m_inst;
+};
+
+std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
+{
return std::make_shared<JarModTask>(std::dynamic_pointer_cast<OneSixInstance>(shared_from_this()));
}
@@ -696,3 +697,5 @@ QStringList OneSixInstance::getNativeJars() const
m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars, getLocalLibraryPath(), binRoot());
return nativeJars;
}
+
+#include "OneSixInstance.moc"
diff --git a/api/logic/minecraft/onesix/OneSixUpdate.cpp b/api/logic/minecraft/onesix/OneSixUpdate.cpp
index e0027032..07ca5fb2 100644
--- a/api/logic/minecraft/onesix/OneSixUpdate.cpp
+++ b/api/logic/minecraft/onesix/OneSixUpdate.cpp
@@ -142,11 +142,21 @@ void OneSixUpdate::next()
void OneSixUpdate::subtaskSucceeded()
{
+ if(isFinished())
+ {
+ qCritical() << "OneSixUpdate: Subtask" << sender() << "succeeded, but work was already done!";
+ return;
+ }
next();
}
void OneSixUpdate::subtaskFailed(QString error)
{
+ if(isFinished())
+ {
+ qCritical() << "OneSixUpdate: Subtask" << sender() << "failed, but work was already done!";
+ return;
+ }
emitFailed(error);
}
diff --git a/api/logic/minecraft/onesix/update/AssetUpdateTask.h b/api/logic/minecraft/onesix/update/AssetUpdateTask.h
index dff72571..3b500189 100644
--- a/api/logic/minecraft/onesix/update/AssetUpdateTask.h
+++ b/api/logic/minecraft/onesix/update/AssetUpdateTask.h
@@ -5,6 +5,7 @@ class OneSixInstance;
class AssetUpdateTask : public Task
{
+ Q_OBJECT
public:
AssetUpdateTask(OneSixInstance * inst);
void executeTask() override;
diff --git a/api/logic/minecraft/onesix/update/FMLLibrariesTask.h b/api/logic/minecraft/onesix/update/FMLLibrariesTask.h
index d1c250e4..616053d7 100644
--- a/api/logic/minecraft/onesix/update/FMLLibrariesTask.h
+++ b/api/logic/minecraft/onesix/update/FMLLibrariesTask.h
@@ -5,6 +5,7 @@ class OneSixInstance;
class FMLLibrariesTask : public Task
{
+ Q_OBJECT
public:
FMLLibrariesTask(OneSixInstance * inst);
diff --git a/api/logic/minecraft/onesix/update/FoldersTask.cpp b/api/logic/minecraft/onesix/update/FoldersTask.cpp
index 239a2675..d478560c 100644
--- a/api/logic/minecraft/onesix/update/FoldersTask.cpp
+++ b/api/logic/minecraft/onesix/update/FoldersTask.cpp
@@ -3,6 +3,7 @@
#include <QDir>
FoldersTask::FoldersTask(OneSixInstance * inst)
+ :Task()
{
m_inst = inst;
}
diff --git a/api/logic/minecraft/onesix/update/FoldersTask.h b/api/logic/minecraft/onesix/update/FoldersTask.h
index 552d3098..7cdc5a93 100644
--- a/api/logic/minecraft/onesix/update/FoldersTask.h
+++ b/api/logic/minecraft/onesix/update/FoldersTask.h
@@ -5,6 +5,7 @@
class OneSixInstance;
class FoldersTask : public Task
{
+ Q_OBJECT
public:
FoldersTask(OneSixInstance * inst);
void executeTask() override;
diff --git a/api/logic/minecraft/onesix/update/LibrariesTask.h b/api/logic/minecraft/onesix/update/LibrariesTask.h
index 80cf0d2a..a84975e5 100644
--- a/api/logic/minecraft/onesix/update/LibrariesTask.h
+++ b/api/logic/minecraft/onesix/update/LibrariesTask.h
@@ -5,6 +5,7 @@ class OneSixInstance;
class LibrariesTask : public Task
{
+ Q_OBJECT
public:
LibrariesTask(OneSixInstance * inst);