From 849c3a9bececfdeba8495f09dc057f62236027e8 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Fri, 30 Mar 2012 23:12:52 +0200 Subject: [PATCH] add the section to the ini-keys --- apps/mwiniimporter/importer.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index d0cfe4a04..f662f42d6 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -10,6 +10,7 @@ void MwIniImporter::setVerbose(bool verbose) { strmap MwIniImporter::loadIniFile(std::string filename) { std::cout << "load ini file: " << filename << std::endl; + std::string section(""); std::map map; boost::iostreams::streamfile(filename.c_str()); @@ -17,17 +18,25 @@ strmap MwIniImporter::loadIniFile(std::string filename) { while (std::getline(file, line)) { // ignore sections for now - if(line.empty() || line[0] == ';' || line[0] == '[') { + if(line.empty() || line[0] == ';') { continue; } + if(line[0] == '[') { + if(line.length() > 2) { + section = line.substr(1, line.length()-3); + continue; + } + throw IniParseException(); + } + int pos = line.find("="); if(pos < 1) { throw IniParseException(); } map.insert(std::pair( - line.substr(0,pos), line.substr(pos+1) + section + " " + line.substr(0,pos), line.substr(pos+1) )); }