GH-887 fix patch file removal
This commit is contained in:
parent
4d8f068f9c
commit
28aa8f342e
@ -99,10 +99,14 @@ bool MinecraftProfile::canRemove(const int index) const
|
|||||||
bool MinecraftProfile::remove(const int index)
|
bool MinecraftProfile::remove(const int index)
|
||||||
{
|
{
|
||||||
if (!canRemove(index))
|
if (!canRemove(index))
|
||||||
|
{
|
||||||
|
qDebug() << "Patch" << index << "is non-removable";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(!m_strategy->removePatch(VersionPatches.at(index)))
|
if(!m_strategy->removePatch(VersionPatches.at(index)))
|
||||||
{
|
{
|
||||||
|
qCritical() << "Patch" << index << "could not be removed";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,6 +186,15 @@ bool OneSixProfileStrategy::removePatch(ProfilePatchPtr patch)
|
|||||||
bool ok = true;
|
bool ok = true;
|
||||||
// first, remove the patch file. this ensures it's not used anymore
|
// first, remove the patch file. this ensures it's not used anymore
|
||||||
auto fileName = patch->getPatchFilename();
|
auto fileName = patch->getPatchFilename();
|
||||||
|
if(fileName.size())
|
||||||
|
{
|
||||||
|
QFile patchFile(fileName);
|
||||||
|
if(patchFile.exists() && !patchFile.remove())
|
||||||
|
{
|
||||||
|
qCritical() << "File" << fileName << "could not be removed because:" << patchFile.errorString();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
auto preRemoveJarMod = [&](JarmodPtr jarMod) -> bool
|
auto preRemoveJarMod = [&](JarmodPtr jarMod) -> bool
|
||||||
@ -194,7 +203,13 @@ bool OneSixProfileStrategy::removePatch(ProfilePatchPtr patch)
|
|||||||
QFileInfo finfo (fullpath);
|
QFileInfo finfo (fullpath);
|
||||||
if(finfo.exists())
|
if(finfo.exists())
|
||||||
{
|
{
|
||||||
return QFile::remove(fullpath);
|
QFile jarModFile(fullpath);
|
||||||
|
if(!jarModFile.remove())
|
||||||
|
{
|
||||||
|
qCritical() << "File" << fullpath << "could not be removed because:" << jarModFile.errorString();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user