1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-29 01:49:55 +03:00

Merge pull request #2840 from linkmauve/use-xdg-config-home

sd-path: use XDG_CONFIG_HOME instead of hardcoding ~/.config for user-dirs
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-03-15 00:55:08 -04:00

View File

@ -89,7 +89,8 @@ static int from_home_dir(const char *envname, const char *suffix, char **buffer,
static int from_user_dir(const char *field, char **buffer, const char **ret) {
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *b = NULL;
const char *fn = NULL;
_cleanup_free_ const char *fn = NULL;
const char *c = NULL;
char line[LINE_MAX];
size_t n;
int r;
@ -98,10 +99,14 @@ static int from_user_dir(const char *field, char **buffer, const char **ret) {
assert(buffer);
assert(ret);
r = from_home_dir(NULL, ".config/user-dirs.dirs", &b, &fn);
r = from_home_dir("XDG_CONFIG_HOME", ".config", &b, &c);
if (r < 0)
return r;
fn = strappend(c, "/user-dirs.dirs");
if (!fn)
return -ENOMEM;
f = fopen(fn, "re");
if (!f) {
if (errno == ENOENT)