Remove file on mod duplication
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
38d77b58cd
commit
3d84635b24
@ -371,13 +371,13 @@ void InstanceList::undoTrashInstance()
|
|||||||
|
|
||||||
auto top = m_trashHistory.pop();
|
auto top = m_trashHistory.pop();
|
||||||
|
|
||||||
while (QDir(top.polyPath).exists()) {
|
while (QDir(top.rootPath).exists()) {
|
||||||
top.id += "1";
|
top.id += "1";
|
||||||
top.polyPath += "1";
|
top.rootPath += "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Moving" << top.trashPath << "back to" << top.polyPath;
|
qDebug() << "Moving" << top.trashPath << "back to" << top.rootPath;
|
||||||
QFile(top.trashPath).rename(top.polyPath);
|
QFile(top.trashPath).rename(top.rootPath);
|
||||||
|
|
||||||
m_instanceGroupIndex[top.id] = top.groupName;
|
m_instanceGroupIndex[top.id] = top.groupName;
|
||||||
increaseGroupCount(top.groupName);
|
increaseGroupCount(top.groupName);
|
||||||
@ -634,8 +634,8 @@ InstancePtr InstanceList::loadInstance(const InstanceId& id)
|
|||||||
|
|
||||||
QString inst_type = instanceSettings->get("InstanceType").toString();
|
QString inst_type = instanceSettings->get("InstanceType").toString();
|
||||||
|
|
||||||
// NOTE: Some PolyMC versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a OneSix
|
// NOTE: Some PrismLauncher versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a
|
||||||
// instance
|
// OneSix instance
|
||||||
if (inst_type == "OneSix" || inst_type.isEmpty()) {
|
if (inst_type == "OneSix" || inst_type.isEmpty()) {
|
||||||
inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot));
|
inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot));
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,7 +58,7 @@ enum class GroupsState { NotLoaded, Steady, Dirty };
|
|||||||
|
|
||||||
struct TrashHistoryItem {
|
struct TrashHistoryItem {
|
||||||
QString id;
|
QString id;
|
||||||
QString polyPath;
|
QString rootPath;
|
||||||
QString trashPath;
|
QString trashPath;
|
||||||
QString groupName;
|
QString groupName;
|
||||||
};
|
};
|
||||||
|
@ -130,15 +130,15 @@ bool Resource::enable(EnableAction action)
|
|||||||
if (!path.endsWith(".disabled"))
|
if (!path.endsWith(".disabled"))
|
||||||
return false;
|
return false;
|
||||||
path.chop(9);
|
path.chop(9);
|
||||||
|
|
||||||
if (!file.rename(path))
|
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
path += ".disabled";
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!file.rename(path))
|
||||||
|
return false;
|
||||||
|
|
||||||
setFile(QFileInfo(path));
|
setFile(QFileInfo(path));
|
||||||
|
|
||||||
|
@ -213,9 +213,6 @@ bool ResourceFolderModel::setResourceEnabled(const QModelIndexList& indexes, Ena
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto new_id = resource->internal_id();
|
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.remove(old_id);
|
||||||
m_resources_index[new_id] = row;
|
m_resources_index[new_id] = row;
|
||||||
|
Loading…
Reference in New Issue
Block a user