ATLauncher: Delete files from configs if they conflict with a mod

This commit is contained in:
Jamie Mansfield 2022-05-23 21:37:09 +01:00
parent 101ca60b2b
commit 4ee5264e24
No known key found for this signature in database
GPG Key ID: 36F61598F39F67B0

View File

@ -781,6 +781,17 @@ bool PackInstallTask::extractMods(
for (auto iter = toCopy.begin(); iter != toCopy.end(); iter++) {
auto &from = iter.key();
auto &to = iter.value();
// If the file already exists, assume the mod is the correct copy - and remove
// the copy from the Configs.zip
QFileInfo fileInfo(to);
if (fileInfo.exists()) {
if (!QFile::remove(to)) {
qWarning() << "Failed to delete" << to;
return false;
}
}
FS::copy fileCopyOperation(from, to);
if(!fileCopyOperation()) {
qWarning() << "Failed to copy" << from << "to" << to;