minIni
minIni copied to clipboard
Improve support for "subsections"
If an INI file contains a "subsection", then in the INI_CALLBACK handler the section name is kind of unexpected. For example in the simple example
[section]
[[subsection]]
key = value
it is [subsection, thus it seems minIni looks for the first right bracket.
A further enhancement would be if the INI_CALLBACK handler is first called with section set to section and key set to NULL, and in the subsequent call with section set to subsection and key set to key. This way the application would actually be notified about the section hierarchy.
If you need subsections, consider this syntax:
[section] key=abc [section:subsection] key=def
Etcetera. This convention can be used with the ini_putX() functions too.
The [[subsection]] syntax is used by Py Config which I have no chance to influence.
The simplest idea ist to check for the last closing bracket instead of the first one. What do you think?