MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / executeTask

Method executeTask

launcher/minecraft/launch/ExtractNatives.cpp:83–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void ExtractNatives::executeTask()
84{
85 auto instance = m_parent->instance();
86 std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
87 auto toExtract = minecraftInstance->getNativeJars();
88 if(toExtract.isEmpty())
89 {
90 emitSucceeded();
91 return;
92 }
93 auto settings = minecraftInstance->settings();
94 bool nativeOpenAL = settings->get("UseNativeOpenAL").toBool();
95 bool nativeGLFW = settings->get("UseNativeGLFW").toBool();
96
97 auto outputPath = minecraftInstance->getNativePath();
98 auto javaVersion = minecraftInstance->getJavaVersion();
99 bool jniHackEnabled = javaVersion.major() >= 8;
100 for(const auto &source: toExtract)
101 {
102 if(!unzipNatives(source, outputPath, jniHackEnabled, nativeOpenAL, nativeGLFW))
103 {
104 const char *reason = QT_TR_NOOP("Couldn't extract native jar '%1' to destination '%2'");
105 emit logLine(QString(reason).arg(source, outputPath), MessageLevel::Fatal);
106 emitFailed(tr(reason).arg(source, outputPath));
107 }
108 }
109 emitSucceeded();
110}
111
112void ExtractNatives::finalize()
113{

Callers

nothing calls this directly

Calls 10

unzipNativesFunction · 0.85
QStringClass · 0.85
getNativeJarsMethod · 0.80
isEmptyMethod · 0.80
getNativePathMethod · 0.80
getJavaVersionMethod · 0.80
majorMethod · 0.80
instanceMethod · 0.45
settingsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected