1
0
mirror of https://github.com/systemd/systemd.git synced 2025-04-01 18:50:16 +03:00

sd-path: add support for XDG_STATE_HOME

This commit is contained in:
Lennart Poettering 2023-06-26 18:55:14 +02:00
parent 1c53c3bab1
commit 9a653235d1
4 changed files with 10 additions and 1 deletions

View File

@ -55,6 +55,7 @@
<constant>SD_PATH_USER_CONFIGURATION</constant>,
<constant>SD_PATH_USER_RUNTIME</constant>,
<constant>SD_PATH_USER_STATE_PRIVATE</constant>,
<constant>SD_PATH_USER_STATE_CACHE</constant>,
<constant>SD_PATH_USER</constant>,

View File

@ -281,6 +281,9 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
case SD_PATH_USER_STATE_CACHE:
return from_home_dir("XDG_CACHE_HOME", ".cache", buffer, ret);
case SD_PATH_USER_STATE_PRIVATE:
return from_home_dir("XDG_STATE_HOME", ".local/state", buffer, ret);
case SD_PATH_USER:
r = get_home_dir(buffer);
if (r < 0)

View File

@ -41,6 +41,8 @@ static const char* const path_table[_SD_PATH_MAX] = {
[SD_PATH_USER_CONFIGURATION] = "user-configuration",
[SD_PATH_USER_RUNTIME] = "user-runtime",
[SD_PATH_USER_STATE_CACHE] = "user-state-cache",
[SD_PATH_USER_STATE_PRIVATE] = "user-state-private",
[SD_PATH_USER] = "user",
[SD_PATH_USER_DOCUMENTS] = "user-documents",
[SD_PATH_USER_MUSIC] = "user-music",

View File

@ -53,9 +53,10 @@ enum {
SD_PATH_USER_SHARED,
/* User configuration, state, runtime ... */
SD_PATH_USER_CONFIGURATION, /* takes both actual configuration (like /etc) and state (like /var/lib) */
SD_PATH_USER_CONFIGURATION,
SD_PATH_USER_RUNTIME,
SD_PATH_USER_STATE_CACHE,
/* → SD_PATH_USER_STATE_PRIVATE is added at the bottom */
/* User resources */
SD_PATH_USER, /* $HOME itself */
@ -116,6 +117,8 @@ enum {
SD_PATH_SYSTEMD_SEARCH_SYSTEM_ENVIRONMENT_GENERATOR,
SD_PATH_SYSTEMD_SEARCH_USER_ENVIRONMENT_GENERATOR,
SD_PATH_USER_STATE_PRIVATE,
_SD_PATH_MAX
};