mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 21:42:13 +00:00
add the section to the ini-keys
This commit is contained in:
parent
c160bc7080
commit
849c3a9bec
@ -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<std::string, std::string> map;
|
||||
boost::iostreams::stream<boost::iostreams::file_source>file(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<std::string,std::string>(
|
||||
line.substr(0,pos), line.substr(pos+1)
|
||||
section + " " + line.substr(0,pos), line.substr(pos+1)
|
||||
));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user