On 22/05/2025 15.27, Stefan Ram wrote:
"Michael F. Stemper" <michael.stem...@gmail.com> wrote or quoted:
Should I specify the location of the config file with a command-line
option, or is requiring the program to be executed in the directory
containing the configuration file considered acceptable practice?

   It was me who digged out this "platformdirs" "user_config_dir"
   API using a source code search on my harddisk without any help.
   But then I asked my buddy, the chatbot, to explain how to
   use it, which I include here, followed by some more words
   of my own at the end. Chatbot:

[massive snip]

   On Linux:

~/.config/YourAppName

[another one]


Wow, if that's the best practice, I'll settle for second-best!

Somebody who wished to remain anonymous contacted me via email and
suggested that I could have my cake and eat it, too. I am going
ahead with having a default location for the config file, as well
as a command-line option to specify a different file. Blindingly
obvious!

And the default will not be in the directory in which the program
is being run. Your post reminded me of the existence of $HOME/.config
which is obviously the right place for it.

Thanks for all of the suggestions.

--
Michael F. Stemper
I refuse to believe that a corporation is a person until Texas executes one.
--
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to