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