Re: [PATCH v4 1/4] cache.h: Introduce a generic "xdg_config_home_for(…)" function
- From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
- Date
- May 24, 2021, 12:23 UTC
- Message-ID
- <YKuayK+lmNfBoYWM@danh.dev>
- In-Reply-To
- <120b6b5c-ab30-6985-d5af-a0b0290b864f@gmail.com>
On 2021-05-24 10:33:30+0100, Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 6 quoted lines
> Hi Lénaïc > > This looks fine to me. I'm not 100% sold on calling the parameter prog as > our program name later in the series ends up being "systemd/user" so > something like "subdir" might have been better but that is not worth > rerolling for.
I'll take the blame for that "prog". I didn't think very hard at the time of writing :(
Yes, "subdir" is definitely better. And it's aligned with the XDG Base Directory specifications:
A user-specific version of the configuration file may be created in $XDG_CONFIG_HOME/subdir/filename
Show 13 quoted lines
> On 24/05/2021 08:15, Lénaïc Huard wrote:
> > Current implementation of `xdg_config_home(filename)` returns
> > `$XDG_CONFIG_HOME/git/$filename`, with the `git` subdirectory inserted
> > between the `XDG_CONFIG_HOME` environment variable and the parameter.
> >
> > This patch introduces a `xdg_config_home_for(prog, filename)` function
> > which is more generic. It only concatenates "$XDG_CONFIG_HOME", or
> > "$HOME/.config" if the former isn’t defined, with the parameters,
> > without adding `git` in between.
> >
> > `xdg_config_home(filename)` is now implemented by calling
> > `xdg_config_home_for("git", filename)` but this new generic function can
> > be used to compute the configuration directory of other programs.-- Danh