diff options
author | Andrew <forkk@forkk.net> | 2013-01-25 12:35:14 -0600 |
---|---|---|
committer | Andrew <forkk@forkk.net> | 2013-01-25 12:35:14 -0600 |
commit | f5ee069ea989a07915eb20c62ec4e812dfa9e701 (patch) | |
tree | 7d2895bf49925aa6ef7cc91caf9a01de694b2eee /data/inifile.cpp | |
parent | 3b422b54aa13be4eb59c80b1f7bb2a514aac583f (diff) | |
parent | 00893b3cfc68f12c09e84643d255044a488b0eb6 (diff) | |
download | MultiMC-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.cpp | 17 |
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; } |