NOISSUE remove the jar-modded jar after the instance finishes
This commit is contained in:
parent
0636c03d7c
commit
1dbc4e16f7
@ -35,15 +35,11 @@ void ModMinecraftJar::executeTask()
|
||||
{
|
||||
emitFailed(tr("Couldn't create the bin folder for Minecraft.jar"));
|
||||
}
|
||||
|
||||
auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar");
|
||||
QFile finalJar(finalJarPath);
|
||||
if(finalJar.exists())
|
||||
{
|
||||
if(!finalJar.remove())
|
||||
if(!removeJar())
|
||||
{
|
||||
emitFailed(tr("Couldn't remove stale jar file: %1").arg(finalJarPath));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// create temporary modded jar, if needed
|
||||
@ -64,3 +60,23 @@ void ModMinecraftJar::executeTask()
|
||||
}
|
||||
emitSucceeded();
|
||||
}
|
||||
|
||||
void ModMinecraftJar::finalize()
|
||||
{
|
||||
removeJar();
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -30,4 +30,7 @@ public:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
void finalize() override;
|
||||
private:
|
||||
bool removeJar();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user