summaryrefslogtreecommitdiffstats
path: root/api/logic/InstanceList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/InstanceList.cpp')
-rw-r--r--api/logic/InstanceList.cpp20
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;