diff options
Diffstat (limited to 'src/filesystem')
| -rw-r--r-- | src/filesystem/inifile.cc | 17 | 
1 files changed, 12 insertions, 5 deletions
diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc index 337cf45..0cc690f 100644 --- a/src/filesystem/inifile.cc +++ b/src/filesystem/inifile.cc @@ -4,6 +4,7 @@     the terms of the GNU General Public License version 2  */ +#include "auxiliary/functions.h"  #include "math/mathlib.h"  #include "filesystem/filesystem.h"  #include "filesystem/inifile.h" @@ -83,21 +84,27 @@ bool IniFile::getline() {  				if (s.size() > 2 && s[0] == '[' && s[s.size()-1] == ']') {  					// condebug << "Inifile got section header " << s << std::endl;  					section_current = s.substr(1, s.size()-2); + +					aux::trim(section_current); +					aux::to_lowercase(section_current); +  					last_read_was_section = true;  					return true;  				} else {  					// key=value pair  					size_t found = s.find('='); -					if (found != std::string::npos) { -						// make lowercase +					if (found != std::string::npos && found > 0) { +						// make lowercase and strip spaces  						key_current = s.substr(0, found); -						while (key_current.size() && key_current[key_current.size()-1] == ' ') -							key_current.erase(key_current.size()-1, 1); +						aux::trim(key_current); +						aux::to_lowercase(key_current);  						if (key_current.size()) {  							value_current = s.substr(found+1, s.size() - found - 1); -							last_read_was_key = true; +							aux::trim (value_current); +							last_read_was_key = true;							 +							//con_debug << "IniFile got " << key_current << "=" << value_current << std::endl;  							return true;  						}  | 
