aboutsummaryrefslogtreecommitdiff
path: root/launcher/settings/INIFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/settings/INIFile.cpp')
-rw-r--r--launcher/settings/INIFile.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/launcher/settings/INIFile.cpp b/launcher/settings/INIFile.cpp
index d16256b9..4fb11ed3 100644
--- a/launcher/settings/INIFile.cpp
+++ b/launcher/settings/INIFile.cpp
@@ -37,11 +37,12 @@
#include "settings/INIFile.h"
#include <FileSystem.h>
+#include <QDebug>
#include <QFile>
-#include <QTextStream>
-#include <QStringList>
#include <QSaveFile>
-#include <QDebug>
+#include <QStringList>
+#include <QTemporaryFile>
+#include <QTextStream>
#include <QSettings>
@@ -71,6 +72,7 @@ bool INIFile::saveFile(QString fileName)
return true;
}
+
QString unescape(QString orig)
{
QString out;
@@ -185,6 +187,19 @@ bool INIFile::loadFile(QString fileName)
return true;
}
+bool INIFile::loadFile(QByteArray data)
+{
+ QTemporaryFile file;
+ if (!file.open())
+ return false;
+ file.write(data);
+ file.flush();
+ file.close();
+ auto loaded = loadFile(file.fileName());
+ file.remove();
+ return loaded;
+}
+
QVariant INIFile::get(QString key, QVariant def) const
{
if (!this->contains(key))