summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-17 01:21:49 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-17 01:21:49 +0100
commitfd34ca5a0f4492c4b280df8aa3d9d82154b5d9bc (patch)
tree8fa95d24d9c50335378806910d8caa4073fb61ca
parent9cf8b42d8923454b335159b08cc6dd551afd9301 (diff)
downloadMultiMC-fd34ca5a0f4492c4b280df8aa3d9d82154b5d9bc.tar
MultiMC-fd34ca5a0f4492c4b280df8aa3d9d82154b5d9bc.tar.gz
MultiMC-fd34ca5a0f4492c4b280df8aa3d9d82154b5d9bc.tar.lz
MultiMC-fd34ca5a0f4492c4b280df8aa3d9d82154b5d9bc.tar.xz
MultiMC-fd34ca5a0f4492c4b280df8aa3d9d82154b5d9bc.zip
NOISSUE always run the ExtractNatives task during launch
The task now checks the conditions, giving the update process time to supply all the metadata.
-rw-r--r--api/logic/BaseInstance.h6
-rw-r--r--api/logic/NullInstance.h3
-rw-r--r--api/logic/launch/LaunchTask.cpp2
-rw-r--r--api/logic/minecraft/MinecraftInstance.cpp2
-rw-r--r--api/logic/minecraft/launch/ExtractNatives.cpp15
-rw-r--r--api/logic/minecraft/launch/ExtractNatives.h5
-rw-r--r--api/logic/minecraft/legacy/LegacyInstance.cpp6
-rw-r--r--api/logic/minecraft/legacy/LegacyInstance.h2
-rw-r--r--api/logic/minecraft/onesix/OneSixInstance.cpp7
-rw-r--r--api/logic/minecraft/onesix/OneSixInstance.h2
10 files changed, 17 insertions, 33 deletions
diff --git a/api/logic/BaseInstance.h b/api/logic/BaseInstance.h
index 147dd703..691a2db1 100644
--- a/api/logic/BaseInstance.h
+++ b/api/logic/BaseInstance.h
@@ -202,12 +202,6 @@ public:
*/
virtual QString getLogFileRoot() = 0;
- /*!
- * does any necessary cleanups after the instance finishes. also runs before\
- * TODO: turn into a task that can run asynchronously
- */
- virtual void cleanupAfterRun() = 0;
-
virtual QString getStatusbarDescription() = 0;
/// FIXME: this really should be elsewhere...
diff --git a/api/logic/NullInstance.h b/api/logic/NullInstance.h
index 5323d135..b530acd3 100644
--- a/api/logic/NullInstance.h
+++ b/api/logic/NullInstance.h
@@ -14,9 +14,6 @@ public:
{
return false;
}
- virtual void cleanupAfterRun() override
- {
- }
virtual QString currentVersionId() const override
{
return "Null";
diff --git a/api/logic/launch/LaunchTask.cpp b/api/logic/launch/LaunchTask.cpp
index 8b9da398..ea4ed43e 100644
--- a/api/logic/launch/LaunchTask.cpp
+++ b/api/logic/launch/LaunchTask.cpp
@@ -225,14 +225,12 @@ void LaunchTask::onLogLine(QString line, MessageLevel::Enum level)
void LaunchTask::emitSucceeded()
{
- m_instance->cleanupAfterRun();
m_instance->setRunning(false);
Task::emitSucceeded();
}
void LaunchTask::emitFailed(QString reason)
{
- m_instance->cleanupAfterRun();
m_instance->setRunning(false);
m_instance->setCrashed(true);
Task::emitFailed(reason);
diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp
index f36e40ed..bcbabb1f 100644
--- a/api/logic/minecraft/MinecraftInstance.cpp
+++ b/api/logic/minecraft/MinecraftInstance.cpp
@@ -450,8 +450,6 @@ std::shared_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr s
}
// extract native jars if needed
- auto jars = getNativeJars();
- if(jars.size())
{
auto step = std::make_shared<ExtractNatives>(pptr);
process->appendStep(step);
diff --git a/api/logic/minecraft/launch/ExtractNatives.cpp b/api/logic/minecraft/launch/ExtractNatives.cpp
index 089e2559..30b5197b 100644
--- a/api/logic/minecraft/launch/ExtractNatives.cpp
+++ b/api/logic/minecraft/launch/ExtractNatives.cpp
@@ -71,8 +71,13 @@ void ExtractNatives::executeTask()
{
auto instance = m_parent->instance();
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
- auto outputPath = minecraftInstance->getNativePath();
auto toExtract = minecraftInstance->getNativeJars();
+ if(toExtract.isEmpty())
+ {
+ emitSucceeded();
+ return;
+ }
+ auto outputPath = minecraftInstance->getNativePath();
auto javaVersion = minecraftInstance->getJavaVersion();
bool jniHackEnabled = javaVersion.major() >= 8;
for(const auto &source: toExtract)
@@ -84,3 +89,11 @@ void ExtractNatives::executeTask()
}
emitSucceeded();
}
+
+void ExtractNatives::finalize()
+{
+ auto instance = m_parent->instance();
+ QString target_dir = FS::PathCombine(instance->instanceRoot(), "natives/");
+ QDir dir(target_dir);
+ dir.removeRecursively();
+}
diff --git a/api/logic/minecraft/launch/ExtractNatives.h b/api/logic/minecraft/launch/ExtractNatives.h
index 699657d7..0c5c831c 100644
--- a/api/logic/minecraft/launch/ExtractNatives.h
+++ b/api/logic/minecraft/launch/ExtractNatives.h
@@ -27,11 +27,12 @@ public:
explicit ExtractNatives(LaunchTask *parent) : LaunchStep(parent){};
virtual ~ExtractNatives(){};
- virtual void executeTask();
- virtual bool canAbort() const
+ void executeTask() override;
+ bool canAbort() const override
{
return false;
}
+ void finalize() override;
};
diff --git a/api/logic/minecraft/legacy/LegacyInstance.cpp b/api/logic/minecraft/legacy/LegacyInstance.cpp
index 7ed2041c..f1132473 100644
--- a/api/logic/minecraft/legacy/LegacyInstance.cpp
+++ b/api/logic/minecraft/legacy/LegacyInstance.cpp
@@ -224,12 +224,6 @@ QStringList LegacyInstance::validLaunchMethods()
return {"Legacy"};
}
-
-void LegacyInstance::cleanupAfterRun()
-{
- // FIXME: delete the launcher and icons and whatnot.
-}
-
std::shared_ptr<ModList> LegacyInstance::coreModList() const
{
if (!core_mod_list)
diff --git a/api/logic/minecraft/legacy/LegacyInstance.h b/api/logic/minecraft/legacy/LegacyInstance.h
index 3db35fc9..2f30b0fd 100644
--- a/api/logic/minecraft/legacy/LegacyInstance.h
+++ b/api/logic/minecraft/legacy/LegacyInstance.h
@@ -117,8 +117,6 @@ public:
virtual std::shared_ptr<Task> createJarModdingTask() override;
virtual QString createLaunchScript(AuthSessionPtr session) override;
- virtual void cleanupAfterRun() override;
-
virtual QString typeName() const override;
bool canExport() const override
diff --git a/api/logic/minecraft/onesix/OneSixInstance.cpp b/api/logic/minecraft/onesix/OneSixInstance.cpp
index 859e2e69..7a54bed1 100644
--- a/api/logic/minecraft/onesix/OneSixInstance.cpp
+++ b/api/logic/minecraft/onesix/OneSixInstance.cpp
@@ -425,13 +425,6 @@ std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
return std::make_shared<JarModTask>(std::dynamic_pointer_cast<OneSixInstance>(shared_from_this()));
}
-void OneSixInstance::cleanupAfterRun()
-{
- QString target_dir = FS::PathCombine(instanceRoot(), "natives/");
- QDir dir(target_dir);
- dir.removeRecursively();
-}
-
std::shared_ptr<ModList> OneSixInstance::loaderModList() const
{
if (!m_loader_mod_list)
diff --git a/api/logic/minecraft/onesix/OneSixInstance.h b/api/logic/minecraft/onesix/OneSixInstance.h
index 170921ae..953281c2 100644
--- a/api/logic/minecraft/onesix/OneSixInstance.h
+++ b/api/logic/minecraft/onesix/OneSixInstance.h
@@ -57,8 +57,6 @@ public:
virtual QString createLaunchScript(AuthSessionPtr session) override;
QStringList verboseDescription(AuthSessionPtr session) override;
- virtual void cleanupAfterRun() override;
-
virtual QString intendedVersionId() const override;
virtual bool setIntendedVersionId(QString version) override;