8000 Support "=" in sub-config file path. · log4cplus/log4cplus@28a6e8a · GitHub
[go: up one dir, main page]

Skip to content

Commit 28a6e8a

Browse files
kxs-bpeiwilx
authored andcommitted
Support "=" in sub-config file path.
If there is a "=" in the path of sub-config file, and we include it in the main config file like: ``` include D:/path/to/sub=config.ini ``` it will not work. Because we parse line with "=" in it as a key/value pair. This PR is going to fix this issue and support "=" in the "include" directive. Signed-off-by: Vaclav Haisman <vhaisman@gmail.com>
1 parent 8b0d527 commit 28a6e8a

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/property.cxx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,8 @@ Properties::init(tistream& input)
247247
// Remove trailing 'Windows' \r.
248248
buffer.resize (buffLen - 1);
249249

250-
tstring::size_type const idx = buffer.find(LOG4CPLUS_TEXT ('='));
251-
if (idx != tstring::npos)
252-
{
253-
tstring key = buffer.substr(0, idx);
254-
tstring value = buffer.substr(idx + 1);
255-
trim_trailing_ws (key);
256-
trim_ws (value);
257-
setProperty(key, value);
258-
}
259-
else if (buffer.compare (0, 7, LOG4CPLUS_TEXT ("include")) == 0
260-
&& buffer.size () >= 7 + 1 + 1
250+
if (buffer.size () >= 7 + 1 + 1
251+
&& buffer.compare (0, 7, LOG4CPLUS_TEXT ("include")) == 0
261252
&& is_space (buffer[7]))
262253
{
263254
tstring included (buffer, 8) ;
@@ -274,6 +265,18 @@ Properties::init(tistream& input)
274265

275266
init (file);
276267
}
268+
else
269+
{
270+
tstring::size_type const idx = buffer.find(LOG4CPLUS_TEXT ('='));
271+
if (idx != tstring::npos)
272+
{
273+
tstring key = buffer.substr(0, idx);
274+
tstring value = buffer.substr(idx + 1);
275+
trim_trailing_ws (key);
276+
trim_ws (value);
277+
setProperty(key, value);
278+
}
279+
}
277280
}
278281
}
279282

0 commit comments

Comments
 (0)
0