Subject: Re: bug#71732: 30.0.50; [FR] xdg: provide an ability to create XDG directory, if it does not exist

From: Eli Zaretskii <[email-masked]>
Date: Sun, 23 Jun 2024 13:12:42 +0300

> Cc: Eli Zaretskii <[email-masked]>, Björn Bidar <[email-masked]>
> From: Ihor Radchenko <[email-masked]>
> Date: Sun, 23 Jun 2024 09:40:49 +0000
> 
> Currently `xdg-cache-home`, and other functions in xdg.el only return
> the path, but never create any directories.

Yes, because whether or not to create a missing directory is up to the
calling application.  For example, if the application is looking for a
file in several possible locations, then a missing directory means
that particular location doesn't have the file, and the application
should look in the other places.

> However, to follow XDG spec, XDG directories must follow certain
> rules. In particular:
> 
>     If, when attempting to write a file, the destination directory is
>     non-existent an attempt should be made to create it with permission
>     0700. If the destination directory exists already the permissions
>     should not be changed.
>   https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
> 
> May you please add a functionality to xdg.el to create the directory
> with right permissions, so that xdg.el users do not need to know these
> technical details of the spec?

xdg.el is not about creating directories, it is about returning their
names.

The ability to create a directory with arbitrary permissions already
exists, and Emacs uses that in umpteen places.  So I'm not sure what
is missing here.  Not every two-liner needs a dedicated named API.