diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-07-31 22:26:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 22:26:20 -0700 |
commit | 2d1197f59f824a3093ad71b9ee3466bd5e2825c8 (patch) | |
tree | 368a2ba5ab9a6ae9f3b3fd0841ea5ee1d0283add /launcher/settings | |
parent | b47993b736ba40a75b5b63290f9d7b5911f8150e (diff) | |
parent | 9137721e8e5b44f2338a36874a393435cbc6daa3 (diff) | |
download | PrismLauncher-2d1197f59f824a3093ad71b9ee3466bd5e2825c8.tar.gz PrismLauncher-2d1197f59f824a3093ad71b9ee3466bd5e2825c8.tar.bz2 PrismLauncher-2d1197f59f824a3093ad71b9ee3466bd5e2825c8.zip |
Merge branch 'develop' into refactor/net-split-headers-to-proxy-class
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/settings')
-rw-r--r-- | launcher/settings/INIFile.cpp | 21 | ||||
-rw-r--r-- | launcher/settings/INIFile.h | 1 |
2 files changed, 19 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)) diff --git a/launcher/settings/INIFile.h b/launcher/settings/INIFile.h index 0d5c05eb..4ee543cf 100644 --- a/launcher/settings/INIFile.h +++ b/launcher/settings/INIFile.h @@ -50,6 +50,7 @@ public: explicit INIFile(); bool loadFile(QString fileName); + bool loadFile(QByteArray data); bool saveFile(QString fileName); QVariant get(QString key, QVariant def) const; |