When saving to an INI file, especially when more than one section is defined, the data is saved all together with no lines between the sections.
For external editing purposes it would be handy to separate each section with a line break, to make it easier to view and edit the INI file.
For Example:
Standard Ini
[GENERAL]
value1=0
value2=somestring
[ADVANCED]
type=1
autosave=0
[OTHER]
showatstartup=1
Ini with seperating lines
[GENERAL]
value1=0
value2=somestring
[ADVANCED]
type=1
autosave=0
[OTHER]
showatstartup=1
How can this be done?
Load the file and insert empty lines before each section name. Here’s a function for it:
Note that if there is already an empty line before the section name, this code will add another one. The loop goes down to one instead of zero assuming we don’t need to add an empty line above the first section in the file.