Re: Best practice for config files?

[email protected]
Newsgroups gmane.comp.python.general
Message-ID <[email protected]>
Hello Michael,

thank you for your important question.

On GNU/Linux (and maybe for POSIX?) systems there is a standard about 
it.

     <https://specifications.freedesktop.org/basedir-spec/>

Look for $XDG_CONFIG_HOME.

To drive it further, you might distinguish between config data (related 
and readable to users) and state data (e.g. size, position of windows, 
...). The later is often also stored in a config file, which is not a 
good idea. For state data you should use $XDG_STATE_HOME.

If the system does not provide the environment variable use a default 
value.

See one example [1] for a config path or for a state file [2].

Feel free to ask back if you have further questions or suggestions.

Regards,
Christian Buhtz

[1] -- 
<https://github.com/buhtz/backintime/blob/3ca90c5ca8940bfff15fca2ba5d6f01fa2b88010/common/konfig.py#L1322-L1333>
[2] -- 
<https://github.com/bit-team/backintime/blob/5b4bf8d1e6bb02c35def360c9a661f4f682a9f7a/qt/statedata.py#L134-L147>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.