This object is in archive! 

Don't append comments to end of settings in config.cfg

Andrew Heard shared this idea 6 years ago
Completed

This is a warning rather than an idea or suggestion - just an observation I found out the hard way that I'd like to share with others that may by mistake do what I did...

As background: Locus has a text file config.cfg that stores a heap of settings. Generally the average Locus user has no need to change these settings from their defaults. Comment lines start with a hash # character in the first column.

I had this idea I would add a comment onto the end of each setting I changed to make it easy with a text editor to later find all my changes. For example:

a8bea4bf2c609a610f2c274130eb1ebc

DO NOT add comments onto the end of a setting as in the screen cap above. Place the comment on its own line if you need to have your own comment as below:

a217f6df49ba88cb3cc1bd5ce5d43f8f

When Locus reads the file it does not parse the comment correctly, and in subsequent re-write of the file at app exit the setting will become zero (0) in most of cases. Then the next time you run Locus "bad things will happen" without warning of malformed/ out-of-range settings. In my case all buttons, menus, ruler disappeared. It took a day to figure out it was related to my new comments.

Replies (3)

photo
1

@menion - after further testing for this topic I find any user comment on its own line or even editing of existing comment is overwritten when Locus exits. So in fact it is not possible for the user to add comments. I know in other topics you would like to eliminate this file altogether, so rather than making a further suggestion like "allow user to add comments to config file" I will just make this note for other users to be aware.

photo
1

Hi,

hmm, understand. The file is overwritten everytime you exit Locus Map app, so comments should be always immediately lost.

Fact that values are incorrectly handled in case you place a comment in the same line as value makes sense (at least to me) because everything after "=" character is trying to convert to the number.

I may only hope, that no one from config-editing-users will have these ideas, but thanks for pointing on this "issue". I've added warning on this into header of generated config.cfg, at least.

photo
1

If anyone is as silly as me with the same "issue" and search for help, at least this may be of some use to them. It is a little different to other INI & YAML files where comments are generally preserved in re-write.

Replies have been locked on this page!