summaryrefslogtreecommitdiffstats
path: root/logic/settings
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-06-03 21:10:28 +0200
committerPetr Mrázek <peterix@gmail.com>2015-06-06 21:23:05 +0200
commit06a67fbd3852cdaa9bb4d8e2900543b47360f0fc (patch)
treec0f5e05661c1c31ae9815a8543157d45167100e3 /logic/settings
parent3a8b238052163952831fb5924b2483a375e86ebd (diff)
downloadMultiMC-06a67fbd3852cdaa9bb4d8e2900543b47360f0fc.tar
MultiMC-06a67fbd3852cdaa9bb4d8e2900543b47360f0fc.tar.gz
MultiMC-06a67fbd3852cdaa9bb4d8e2900543b47360f0fc.tar.lz
MultiMC-06a67fbd3852cdaa9bb4d8e2900543b47360f0fc.tar.xz
MultiMC-06a67fbd3852cdaa9bb4d8e2900543b47360f0fc.zip
NOISSUE use FS a bit more
Diffstat (limited to 'logic/settings')
-rw-r--r--logic/settings/INIFile.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/logic/settings/INIFile.cpp b/logic/settings/INIFile.cpp
index 5d9052e9..5f39f213 100644
--- a/logic/settings/INIFile.cpp
+++ b/logic/settings/INIFile.cpp
@@ -14,6 +14,7 @@
*/
#include "settings/INIFile.h"
+#include <FileSystem.h>
#include <QFile>
#include <QTextStream>
@@ -74,14 +75,7 @@ QString INIFile::escape(QString orig)
bool INIFile::saveFile(QString fileName)
{
- QSaveFile file(fileName);
- if(!file.open(QIODevice::WriteOnly))
- {
- qCritical() << "Unable to open INI config file" << fileName << "for saving";
- return false;
- }
QByteArray outArray;
-
for (Iterator iter = begin(); iter != end(); iter++)
{
QString value = iter.value().toString();
@@ -91,18 +85,17 @@ bool INIFile::saveFile(QString fileName)
outArray.append(value.toUtf8());
outArray.append('\n');
}
- if(file.write(outArray) != outArray.size())
+
+ try
{
- qCritical() << "Unable to write to the INI config file" << fileName;
- file.cancelWriting();
- return false;
+ FS::write(fileName, outArray);
}
- if(!file.commit())
+ catch (Exception & e)
{
- qCritical() << "Unable to commit the INI config file" << fileName;
- file.cancelWriting();
+ qCritical() << e.what();
return false;
}
+
return true;
}