mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-18 10:16:39 +00:00
trim_ws, too
This commit is contained in:
parent
88fe079f95
commit
e345fca99a
1 changed files with 19 additions and 0 deletions
|
@ -11,6 +11,23 @@
|
||||||
|
|
||||||
namespace sfs = std::filesystem;
|
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()
|
MwIniImporter::MwIniImporter()
|
||||||
: mVerbose(false)
|
: mVerbose(false)
|
||||||
, mEncoding(ToUTF8::WINDOWS_1250)
|
, 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 key(line.substr(0, pos));
|
||||||
std::string value(line.substr(pos + 1));
|
std::string value(line.substr(pos + 1));
|
||||||
|
key = trim_ws(key);
|
||||||
|
value = trim_ws(key);
|
||||||
|
|
||||||
if (map.find(key) == map.end())
|
if (map.find(key) == map.end())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue