NOISSUE always run the ExtractNatives task during launch
The task now checks the conditions, giving the update process time to supply all the metadata.
This commit is contained in:
parent
9cf8b42d89
commit
fd34ca5a0f
@ -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...
|
||||
|
@ -14,9 +14,6 @@ public:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void cleanupAfterRun() override
|
||||
{
|
||||
}
|
||||
virtual QString currentVersionId() const override
|
||||
{
|
||||
return "Null";
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user