[Gambas-user] gb.settings comments deleted
Lewis Balentine
lewis at ...3412...
Fri Dec 5 21:42:40 CET 2014
*.conf appears to be similar to *.ini files found for decades on the the
ms windows platform. I have always preferred them in that environment
rather than the newfangled and nearly unmanageable windows registry.
They allow one to modify the operation of a program without having to go
change the source code. It is handy to be able to modify these
configuration files with a plane text editor to meet requirements of a
change in the environment (i.e. that critical shared network directory
has been moved to another location). After number of years not touching
a particular ini/conf file it may be useful to have a few comment in the
file to refresh one memory cells. Another unusual feature of the conf
files is that gb.setting reorders the order of the slots ...
interestingly enough it maintains the order of the keys under the slots.
One needs to be adaptable. In the case in question I have inserted a few
remarks as :
[0-kvpr]
remark0 = "all comment lines are stripped from this file by the application"
remark1 = "these directory paths must be terminated with a forward slash
'/'."
...
[1-job control]
remark0 = "job 001 is a template, do not delete it."
...
Problem (at least mine) solved :-)
regards,
Lewis
On 12/05/2014 08:36 AM, Benoît Minisini wrote:
> Le 05/12/2014 15:18, Tobias Boege a écrit :
>> On Fri, 05 Dec 2014, Beno?t Minisini wrote:
>>> Le 05/12/2014 12:07, Lewis Balentine a ?crit :
>>>> When settings are written back to the ".conf" file all comments/remarks
>>>> are stripped from the file.
>>>> Should not the documentation include a warning to this effect?
>>> Yes.
>>>
>>>> Better yet would be to keep those comments/remarks intact.
>>> It's not really possible.
>>>
>> I didn't even know that comments were allowed. The wiki states it, yes, but
>> the class interface doesn't offer it.
>>
>> How about a Settings.Comments As Collection property which can associate to
>> a (valid) key in the Settings a few lines to put before that item in the
>> settings file? This can be parsed correctly and later written to the file in
>> order again. One may even imagine that the empty key can receive a comment
>> which is put at the beginning of the comment file.
>>
>> Regards,
>> Tobi
>>
> Pfff. I would say that if you need comments to edit a settings file by
> hand, you shouldn't do that. :-)
>
More information about the User
mailing list