Configuration file formatting

I’m working on a small, pointless ncurses app. It’s going to need to store some local configuration data (key:value, just for startup), but is not complex enough to warrant messing with GSettings.

What’s the Recommended formatting for simple text-config stuff in these modern times? Because poking through various stuff in ~/.config, ~/.gnome, and ~./local, there’s a mix of INI-style, line-oriented plaintext, JSON, some XML, some stray YAML-ish stuff… (This means miscellaneous GNOME apps like Yelp, Gedit, shell, and so on.)

For obvious reasons, XML is out, and practically speaking JSON is not necessary. I’m just wondering what, if anything, others would advise. ?

"key-files seems simple enough for what you need.

https://developer.gnome.org/glib/stable/glib-Key-value-file-parser.html

3 Likes

So — thanks for the reply.

Just to reiterate, in case something got lost, the question was solely about the formatting of text configuration files. The program in question does not use any GNOME libraries; choosing the config-file format is only a matter of adhering to best practices™ to minimize the odds of headaches somewhere further down the road.

Thus, you’re suggesting INI-style, correct?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.