diff options
Diffstat (limited to 'logic/settings/INIFile.cpp')
-rw-r--r-- | logic/settings/INIFile.cpp | 21 |
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; } |