mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-17 08:26:50 -04:00
trim_ws, too
This commit is contained in:
parent
88fe079f95
commit
e345fca99a
@ -11,6 +11,23 @@
|
||||
|
||||
namespace sfs = std::filesystem;
|
||||
|
||||
namespace
|
||||
{
|
||||
// from configfileparser.cpp
|
||||
std::string trim_ws(const std::string& s)
|
||||
{
|
||||
std::string::size_type n, n2;
|
||||
n = s.find_first_not_of(" \t\r\n");
|
||||
if (n == std::string::npos)
|
||||
return std::string();
|
||||
else
|
||||
{
|
||||
n2 = s.find_last_not_of(" \t\r\n");
|
||||
return s.substr(n, n2 - n + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MwIniImporter::MwIniImporter()
|
||||
: mVerbose(false)
|
||||
, mEncoding(ToUTF8::WINDOWS_1250)
|
||||
@ -371,6 +388,8 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::filesystem::pat
|
||||
|
||||
std::string key(line.substr(0, pos));
|
||||
std::string value(line.substr(pos + 1));
|
||||
key = trim_ws(key);
|
||||
value = trim_ws(key);
|
||||
|
||||
if (map.find(key) == map.end())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user