summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index d00c547b..790c7150 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -1016,13 +1016,26 @@ void CConfigManager::applyUserDefinedVars(std::string& line, const size_t equals
void CConfigManager::parseLine(std::string& line) {
// first check if its not a comment
- const auto COMMENTSTART = line.find_first_of('#');
- if (COMMENTSTART == 0)
+ if (line[0] == '#')
return;
- // now, cut the comment off
- if (COMMENTSTART != std::string::npos)
- line = line.substr(0, COMMENTSTART);
+ // now, cut the comment off. ## is an escape.
+ for (long unsigned int i = 1; i < line.length(); ++i) {
+ if (line[i] == '#') {
+ if (i + 1 < line.length() && line[i + 1] != '#') {
+ line = line.substr(0, i);
+ break; // no need to parse more
+ }
+
+ i++;
+ }
+ }
+
+ size_t startPos = 0;
+ while ((startPos = line.find("##", startPos)) != std::string::npos) {
+ line.replace(startPos, 2, "#");
+ startPos++;
+ }
// remove shit at the beginning
while (line[0] == ' ' || line[0] == '\t') {