Remove file on mod duplication

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-10-26 20:09:12 +03:00
parent 38d77b58cd
commit 3d84635b24
4 changed files with 12 additions and 15 deletions

View File

@ -130,15 +130,15 @@ bool Resource::enable(EnableAction action)
if (!path.endsWith(".disabled"))
return false;
path.chop(9);
if (!file.rename(path))
return false;
} else {
path += ".disabled";
if (!file.rename(path))
}
if (QFileInfo::exists(path)) { // the path exists so just remove the file at path
if (!QFile::remove(path))
return false;
}
if (!file.rename(path))
return false;
setFile(QFileInfo(path));

View File

@ -213,9 +213,6 @@ bool ResourceFolderModel::setResourceEnabled(const QModelIndexList& indexes, Ena
}
auto new_id = resource->internal_id();
if (m_resources_index.contains(new_id)) {
// FIXME: https://github.com/PolyMC/PolyMC/issues/550
}
m_resources_index.remove(old_id);
m_resources_index[new_id] = row;