summaryrefslogtreecommitdiffstats
path: root/data/inifile.cpp
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-01-25 12:35:14 -0600
committerAndrew <forkk@forkk.net>2013-01-25 12:35:14 -0600
commitf5ee069ea989a07915eb20c62ec4e812dfa9e701 (patch)
tree7d2895bf49925aa6ef7cc91caf9a01de694b2eee /data/inifile.cpp
parent3b422b54aa13be4eb59c80b1f7bb2a514aac583f (diff)
parent00893b3cfc68f12c09e84643d255044a488b0eb6 (diff)
downloadMultiMC-f5ee069ea989a07915eb20c62ec4e812dfa9e701.tar
MultiMC-f5ee069ea989a07915eb20c62ec4e812dfa9e701.tar.gz
MultiMC-f5ee069ea989a07915eb20c62ec4e812dfa9e701.tar.lz
MultiMC-f5ee069ea989a07915eb20c62ec4e812dfa9e701.tar.xz
MultiMC-f5ee069ea989a07915eb20c62ec4e812dfa9e701.zip
Merge branch 'master' of git://github.com/peterix/MultiMC5
Diffstat (limited to 'data/inifile.cpp')
-rw-r--r--data/inifile.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/data/inifile.cpp b/data/inifile.cpp
index df94e43e..2d68caf6 100644
--- a/data/inifile.cpp
+++ b/data/inifile.cpp
@@ -49,12 +49,23 @@ bool INIFile::loadFile(QString fileName)
QStringList lines = in.readAll().split('\n');
for (int i = 0; i < lines.count(); i++)
{
+ QString & lineRaw = lines[i];
// Ignore comments.
- QString line = lines[i].left('#').trimmed();
+ QString line = lineRaw.left(lineRaw.indexOf('#')).trimmed();
- QString key = line.section('=', 0).trimmed();
- QVariant value(line.section('=', 1).trimmed());
+ int eqPos = line.indexOf('=');
+ if(eqPos == -1)
+ continue;
+ QString key = line.left(eqPos).trimmed();
+ QString valueStr = line.right(line.length() - eqPos - 1).trimmed();
+ QVariant value(valueStr);
+ /*
+ QString dbg = key;
+ dbg += " = ";
+ dbg += valueStr;
+ qDebug(dbg.toLocal8Bit());
+ */
this->operator [](key) = value;
}