summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2013-12-02 12:02:37 +0100
committerJan Dalheimer <jan@dalheimer.de>2013-12-02 12:02:37 +0100
commit4435016faef8a5b57ebb8fece123e6e527e83167 (patch)
treee909544d0334cf1c885f5427f07a148d00783214 /logic
parent0a6399b52cc72980b4847510cc183b54c75d1821 (diff)
downloadMultiMC-4435016faef8a5b57ebb8fece123e6e527e83167.tar
MultiMC-4435016faef8a5b57ebb8fece123e6e527e83167.tar.gz
MultiMC-4435016faef8a5b57ebb8fece123e6e527e83167.tar.lz
MultiMC-4435016faef8a5b57ebb8fece123e6e527e83167.tar.xz
MultiMC-4435016faef8a5b57ebb8fece123e6e527e83167.zip
Fix some bugs that surfaced
Diffstat (limited to 'logic')
-rw-r--r--logic/lists/InstanceList.cpp5
-rw-r--r--logic/lists/MojangAccountList.cpp11
2 files changed, 16 insertions, 0 deletions
diff --git a/logic/lists/InstanceList.cpp b/logic/lists/InstanceList.cpp
index 697694b4..94481fb9 100644
--- a/logic/lists/InstanceList.cpp
+++ b/logic/lists/InstanceList.cpp
@@ -37,6 +37,11 @@ InstanceList::InstanceList(const QString &instDir, QObject *parent)
: QAbstractListModel(parent), m_instDir(instDir)
{
connect(MMC, &MultiMC::aboutToQuit, this, &InstanceList::saveGroupList);
+
+ if (!QDir::current().exists(m_instDir))
+ {
+ QDir::current().mkpath(m_instDir);
+ }
}
InstanceList::~InstanceList()
diff --git a/logic/lists/MojangAccountList.cpp b/logic/lists/MojangAccountList.cpp
index 466cc934..439b5da6 100644
--- a/logic/lists/MojangAccountList.cpp
+++ b/logic/lists/MojangAccountList.cpp
@@ -22,6 +22,7 @@
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonParseError>
+#include <QDir>
#include "logger/QsLog.h"
@@ -233,6 +234,11 @@ bool MojangAccountList::loadList(const QString &filePath)
return false;
}
+ if (!QDir::current().exists(path))
+ {
+ QDir::current().mkpath(path);
+ }
+
QFile file(path);
// Try to open the file and fail if we can't.
@@ -316,6 +322,11 @@ bool MojangAccountList::saveList(const QString &filePath)
return false;
}
+ if (!QDir::current().exists(path))
+ {
+ QDir::current().mkpath(path);
+ }
+
QLOG_INFO() << "Writing account list to" << path;
QLOG_DEBUG() << "Building JSON data structure.";