diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-07-31 14:40:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 14:40:27 +0100 |
commit | b572f75dbaad61cf305f1fd4f60ba94d74bfa3fa (patch) | |
tree | 4e1ad65d3e51a1c3a1d7cae3a203fadddb3bbc2f /launcher/settings | |
parent | 719d87de3bb6f65bc63ad518126074fd9f5f6283 (diff) | |
parent | 9137721e8e5b44f2338a36874a393435cbc6daa3 (diff) | |
download | PrismLauncher-b572f75dbaad61cf305f1fd4f60ba94d74bfa3fa.tar.gz PrismLauncher-b572f75dbaad61cf305f1fd4f60ba94d74bfa3fa.tar.bz2 PrismLauncher-b572f75dbaad61cf305f1fd4f60ba94d74bfa3fa.zip |
Merge branch 'PrismLauncher:develop' into icon-indexing
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; |