summaryrefslogtreecommitdiffstats
path: root/depends/settings/src/inifile.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-08-27 22:32:41 +0200
committerPetr Mrázek <peterix@gmail.com>2013-08-27 22:32:41 +0200
commitfcd05ca2f6b7a76063c98e2720be758be1f67980 (patch)
tree29638132d6f5365a6db0ec0d42a3d3ff1caf9c3e /depends/settings/src/inifile.cpp
parenta266e5d0ccafe1585bafd471d7a71181358ceb59 (diff)
downloadMultiMC-fcd05ca2f6b7a76063c98e2720be758be1f67980.tar
MultiMC-fcd05ca2f6b7a76063c98e2720be758be1f67980.tar.gz
MultiMC-fcd05ca2f6b7a76063c98e2720be758be1f67980.tar.lz
MultiMC-fcd05ca2f6b7a76063c98e2720be758be1f67980.tar.xz
MultiMC-fcd05ca2f6b7a76063c98e2720be758be1f67980.zip
Read mod files to get versions... and stuff.
Diffstat (limited to 'depends/settings/src/inifile.cpp')
-rw-r--r--depends/settings/src/inifile.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/depends/settings/src/inifile.cpp b/depends/settings/src/inifile.cpp
index b3ee3a90..1eae5609 100644
--- a/depends/settings/src/inifile.cpp
+++ b/depends/settings/src/inifile.cpp
@@ -60,10 +60,16 @@ bool INIFile::saveFile(QString fileName)
bool INIFile::loadFile(QString fileName)
{
- // TODO Handle errors.
QFile file(fileName);
- file.open(QIODevice::ReadOnly);
- QTextStream in(&file);
+ if(!file.open(QIODevice::ReadOnly))
+ return false;
+ bool success = loadFile(file.readAll());
+ file.close();
+ return success;
+}
+bool INIFile::loadFile( QByteArray file )
+{
+ QTextStream in(file);
in.setCodec("UTF-8");
QStringList lines = in.readAll().split('\n');