aboutsummaryrefslogtreecommitdiff
path: root/launcher/settings/INIFile.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-06 21:54:00 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2023-08-06 21:54:00 +0200
commit74fe2fb2a6282a9292cc912b865ce0179dbc3412 (patch)
treed006abece962a65d3538b9b0d8f4e3d264d59eca /launcher/settings/INIFile.cpp
parenta83e5be8f2acd66f83ad181e54fe688ed08c1b6f (diff)
parentefaf4024ab22a53a3ef05f0a41b746b7561e087c (diff)
downloadPrismLauncher-74fe2fb2a6282a9292cc912b865ce0179dbc3412.tar.gz
PrismLauncher-74fe2fb2a6282a9292cc912b865ce0179dbc3412.tar.bz2
PrismLauncher-74fe2fb2a6282a9292cc912b865ce0179dbc3412.zip
Merge remote-tracking branch 'upstream/staging' into curseforge-url-handle
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))