diff options
Diffstat (limited to 'Source/Core/Common/Src/IniFile.cpp')
| -rw-r--r-- | Source/Core/Common/Src/IniFile.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Source/Core/Common/Src/IniFile.cpp b/Source/Core/Common/Src/IniFile.cpp index 325b87278a..85a88bc7fc 100644 --- a/Source/Core/Common/Src/IniFile.cpp +++ b/Source/Core/Common/Src/IniFile.cpp @@ -350,7 +350,7 @@ bool IniFile::GetKeys(const char* sectionName, std::vector<std::string>& keys) c } // Return a list of all lines in a section -bool IniFile::GetLines(const char* sectionName, std::vector<std::string>& lines) const +bool IniFile::GetLines(const char* sectionName, std::vector<std::string>& lines, const bool remove_comments) const { const Section* section = GetSection(sectionName); if (!section) @@ -360,15 +360,19 @@ bool IniFile::GetLines(const char* sectionName, std::vector<std::string>& lines) for (std::vector<std::string>::const_iterator iter = section->lines.begin(); iter != section->lines.end(); ++iter) { std::string line = StripSpaces(*iter); - int commentPos = (int)line.find('#'); - if (commentPos == 0) - { - continue; - } - if (commentPos != (int)std::string::npos) + if (remove_comments) { - line = StripSpaces(line.substr(0, commentPos)); + int commentPos = (int)line.find('#'); + if (commentPos == 0) + { + continue; + } + + if (commentPos != (int)std::string::npos) + { + line = StripSpaces(line.substr(0, commentPos)); + } } lines.push_back(line); |
