MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / executeTask

Method executeTask

launcher/minecraft/launch/ModMinecraftJar.cpp:43–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41#include "minecraft/PackProfile.h"
42
43void ModMinecraftJar::executeTask()
44{
45 auto m_inst = m_parent->instance();
46
47 if (!m_inst->getJarMods().size()) {
48 emitSucceeded();
49 return;
50 }
51 // nuke obsolete stripped jar(s) if needed
52 if (!FS::ensureFolderPathExists(m_inst->binRoot())) {
53 emitFailed(tr("Couldn't create the bin folder for Minecraft.jar"));
54 }
55
56 auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar");
57 if (!removeJar()) {
58 emitFailed(tr("Couldn't remove stale jar file: %1").arg(finalJarPath));
59 }
60
61 // create temporary modded jar, if needed
62 auto components = m_inst->getPackProfile();
63 auto profile = components->getProfile();
64 auto jarMods = m_inst->getJarMods();
65 if (jarMods.size()) {
66 auto mainJar = profile->getMainJar();
67 QStringList jars, temp1, temp2, temp3, temp4;
68 mainJar->getApplicableFiles(m_inst->runtimeContext(), jars, temp1, temp2, temp3, m_inst->getLocalLibraryPath());
69 auto sourceJarPath = jars[0];
70 if (!MMCZip::createModdedJar(sourceJarPath, finalJarPath, jarMods)) {
71 emitFailed(tr("Failed to create the custom Minecraft jar file."));
72 return;
73 }
74 }
75 emitSucceeded();
76}
77
78void ModMinecraftJar::finalize()
79{

Callers

nothing calls this directly

Calls 13

ensureFolderPathExistsFunction · 0.85
createModdedJarFunction · 0.85
getJarModsMethod · 0.80
binRootMethod · 0.80
getPackProfileMethod · 0.80
getProfileMethod · 0.80
getMainJarMethod · 0.80
getApplicableFilesMethod · 0.80
getLocalLibraryPathMethod · 0.80
QDirClass · 0.50
instanceMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected