diff options
author | Petr Mrázek <peterix@gmail.com> | 2018-07-23 00:49:26 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2018-07-28 22:12:57 +0200 |
commit | 7b439c85c0bf3583ac8970e7ab9e8db3bd65c968 (patch) | |
tree | 0907bda540ed3df50ad15ff3265dc0c819146227 /api/logic/InstanceList.cpp | |
parent | 12f2716f31e09d18d47ffdbb6c06dfb71c6ec8fb (diff) | |
download | MultiMC-7b439c85c0bf3583ac8970e7ab9e8db3bd65c968.tar MultiMC-7b439c85c0bf3583ac8970e7ab9e8db3bd65c968.tar.gz MultiMC-7b439c85c0bf3583ac8970e7ab9e8db3bd65c968.tar.lz MultiMC-7b439c85c0bf3583ac8970e7ab9e8db3bd65c968.tar.xz MultiMC-7b439c85c0bf3583ac8970e7ab9e8db3bd65c968.zip |
SCRATCH things and stuff, related to grou saving
Diffstat (limited to 'api/logic/InstanceList.cpp')
-rw-r--r-- | api/logic/InstanceList.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/api/logic/InstanceList.cpp b/api/logic/InstanceList.cpp index c7a22b08..9dd08b5b 100644 --- a/api/logic/InstanceList.cpp +++ b/api/logic/InstanceList.cpp @@ -25,6 +25,7 @@ #include "BaseInstance.h" #include "FolderInstanceProvider.h" +#include "FileSystem.h" InstanceList::InstanceList(QObject *parent) : QAbstractListModel(parent) @@ -118,6 +119,25 @@ void InstanceList::deleteGroup(const QString& name) } } +void InstanceList::deleteInstance(const InstanceId& id) +{ + auto inst = getInstanceById(id); + if(!inst) + { + qDebug() << "Cannot delete instance" << id << " No such instance is present."; + return; + } + + qDebug() << "Will delete instance" << id; + if(!FS::deletePath(inst->instanceRoot())) + { + qWarning() << "Deletion of instance" << id << "has not been completely successful ..."; + return; + } + + qDebug() << "Instance" << id << "has been deleted by MultiMC."; +} + static QMap<InstanceId, InstanceLocator> getIdMapping(const QList<InstancePtr> &list) { QMap<InstanceId, InstanceLocator> out; |