diff options
Diffstat (limited to 'launcher/minecraft/launch/ModMinecraftJar.cpp')
-rw-r--r-- | launcher/minecraft/launch/ModMinecraftJar.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/launcher/minecraft/launch/ModMinecraftJar.cpp b/launcher/minecraft/launch/ModMinecraftJar.cpp index 1d6eecf2..6e73333b 100644 --- a/launcher/minecraft/launch/ModMinecraftJar.cpp +++ b/launcher/minecraft/launch/ModMinecraftJar.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only /* - * PolyMC - Minecraft Launcher + * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net> * * This program is free software: you can redistribute it and/or modify @@ -34,9 +34,9 @@ */ #include "ModMinecraftJar.h" -#include "launch/LaunchTask.h" -#include "MMCZip.h" #include "FileSystem.h" +#include "MMCZip.h" +#include "launch/LaunchTask.h" #include "minecraft/MinecraftInstance.h" #include "minecraft/PackProfile.h" @@ -44,20 +44,17 @@ void ModMinecraftJar::executeTask() { auto m_inst = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance()); - if(!m_inst->getJarMods().size()) - { + if (!m_inst->getJarMods().size()) { emitSucceeded(); return; } // nuke obsolete stripped jar(s) if needed - if(!FS::ensureFolderPathExists(m_inst->binRoot())) - { + if (!FS::ensureFolderPathExists(m_inst->binRoot())) { emitFailed(tr("Couldn't create the bin folder for Minecraft.jar")); } auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar"); - if(!removeJar()) - { + if (!removeJar()) { emitFailed(tr("Couldn't remove stale jar file: %1").arg(finalJarPath)); } @@ -65,14 +62,12 @@ void ModMinecraftJar::executeTask() auto components = m_inst->getPackProfile(); auto profile = components->getProfile(); auto jarMods = m_inst->getJarMods(); - if(jarMods.size()) - { + if (jarMods.size()) { auto mainJar = profile->getMainJar(); QStringList jars, temp1, temp2, temp3, temp4; mainJar->getApplicableFiles(m_inst->runtimeContext(), jars, temp1, temp2, temp3, m_inst->getLocalLibraryPath()); auto sourceJarPath = jars[0]; - if(!MMCZip::createModdedJar(sourceJarPath, finalJarPath, jarMods)) - { + if (!MMCZip::createModdedJar(sourceJarPath, finalJarPath, jarMods)) { emitFailed(tr("Failed to create the custom Minecraft jar file.")); return; } @@ -90,10 +85,8 @@ bool ModMinecraftJar::removeJar() auto m_inst = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance()); auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar"); QFile finalJar(finalJarPath); - if(finalJar.exists()) - { - if(!finalJar.remove()) - { + if (finalJar.exists()) { + if (!finalJar.remove()) { return false; } } |