[Gambas-user] Settings file - preserver comments

Bruce Steers bsteers4 at gmail.com
Mon Feb 8 20:28:20 CET 2021


On Mon, 8 Feb 2021 at 16:39, Benoît Minisini <g4mba5 at gmail.com> wrote:

> Le 08/02/2021 à 08:41, pf a écrit :
> > Hi
> >
> >
> > I use a settings file but when i write to it the comments line made with
> > ; or #  at the start of the line dissapears on update of any value.
> >
> > I would like to keep comments if the settings file is opened in a
> > texteditor so the user can get some tips on the values in the file.
> >
> >
> > Regards
> >
> > Chris
> >
> >
>
> No, because the settings file format is internal, and can change at any
> moment without notice.
>
> The fact that it looks like Windows '*.ini' file is a pure coincidence.
>
>
some alternative options are possible Chris ....

you could use a long more self explanatory Key string like instead of
wanting something like...
*# Window position settings*
*[WPos]*
*x=20*
*y=20*

use
*[WindowPositionSettings]*
*x=20*
*y=20*

or something like this might work for you...

*if Not Settings["WPos/Comment", ""] Then Settings["WPos/Comment"] =
"Window position settings"*
that would give...
*[WPos]*

*Comment="Window Position settings"*
*x=20*
*y=20*

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210208/c7284944/attachment.htm>


More information about the User mailing list