summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/OneSixProfileStrategy.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-04-13 23:26:52 +0200
committerPetr Mrázek <peterix@gmail.com>2015-04-13 23:26:52 +0200
commit28aa8f342ebaf34655ed0c1dd59851adb224fc64 (patch)
tree22c006ffa9a65f2e569dfb13dc2989b6a6891f7e /logic/minecraft/OneSixProfileStrategy.cpp
parent4d8f068f9cc576c7d1fb19551cb2429282a7c449 (diff)
downloadMultiMC-28aa8f342ebaf34655ed0c1dd59851adb224fc64.tar
MultiMC-28aa8f342ebaf34655ed0c1dd59851adb224fc64.tar.gz
MultiMC-28aa8f342ebaf34655ed0c1dd59851adb224fc64.tar.lz
MultiMC-28aa8f342ebaf34655ed0c1dd59851adb224fc64.tar.xz
MultiMC-28aa8f342ebaf34655ed0c1dd59851adb224fc64.zip
GH-887 fix patch file removal
Diffstat (limited to 'logic/minecraft/OneSixProfileStrategy.cpp')
-rw-r--r--logic/minecraft/OneSixProfileStrategy.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/logic/minecraft/OneSixProfileStrategy.cpp b/logic/minecraft/OneSixProfileStrategy.cpp
index 4f596d12..12503a80 100644
--- a/logic/minecraft/OneSixProfileStrategy.cpp
+++ b/logic/minecraft/OneSixProfileStrategy.cpp
@@ -186,6 +186,15 @@ bool OneSixProfileStrategy::removePatch(ProfilePatchPtr patch)
bool ok = true;
// first, remove the patch file. this ensures it's not used anymore
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
@@ -194,7 +203,13 @@ bool OneSixProfileStrategy::removePatch(ProfilePatchPtr patch)
QFileInfo finfo (fullpath);
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;
};