Config debugged
This commit is contained in:
parent
5b7a673b6f
commit
53f0785fee
@ -9,8 +9,8 @@
|
||||
# maxFPS: 30
|
||||
#
|
||||
general:
|
||||
maxFPS: 30
|
||||
theme: bad
|
||||
maxFPS: 30
|
||||
theme: bad
|
||||
|
||||
#############################
|
||||
# #
|
||||
|
@ -45,12 +45,14 @@ void ConfigBuilder::parseFile(const string& fname) {
|
||||
|
||||
vector<string> keyParts;
|
||||
unsigned listIndex;
|
||||
unsigned lineno = 0; // for error handling purposes
|
||||
while (!file.eof()) {
|
||||
string line;
|
||||
getline(file, line);
|
||||
++lineno;
|
||||
auto match = line.find('#');
|
||||
if (match != string::npos)line.erase(match);
|
||||
if (line.empty())continue;
|
||||
if (line.find_first_not_of(' ')==string::npos)continue;
|
||||
|
||||
unsigned currentIndent = 0;
|
||||
while (line[currentIndent] == ' ')++currentIndent;
|
||||
@ -71,7 +73,7 @@ void ConfigBuilder::parseFile(const string& fname) {
|
||||
|
||||
}else{
|
||||
match = line.find(':');
|
||||
if (match == string::npos)throw config_error("Line "+ to_string(currentIndent)+" invalid : |"+line+"|");
|
||||
if (match == string::npos)throw config_error("Line "+ to_string(lineno)+" invalid : |"+line+"|");
|
||||
string key = line.substr(0, match);
|
||||
string value = line.substr(match + 1);
|
||||
trimSpaces(key);
|
||||
|
Loading…
Reference in New Issue
Block a user