diff options
author | Denis Krjuchkov <denis@crazydev.net> | 2013-12-07 03:38:56 +0600 |
---|---|---|
committer | Denis Krjuchkov <denis@crazydev.net> | 2013-12-08 17:25:19 +0600 |
commit | ae2558217897a816248573c1daec1015cd8fd65d (patch) | |
tree | 787d251190c67749367c289a45980c6b75214b30 /src | |
parent | 5d8579217839966187c91e7d13c58370d2c1dffd (diff) | |
download | mpd-ae2558217897a816248573c1daec1015cd8fd65d.tar.gz mpd-ae2558217897a816248573c1daec1015cd8fd65d.tar.xz mpd-ae2558217897a816248573c1daec1015cd8fd65d.zip |
ConfigPath: use standard directory API
Diffstat (limited to '')
-rw-r--r-- | src/ConfigPath.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ConfigPath.cxx b/src/ConfigPath.cxx index 1aa874c5c..81db7063f 100644 --- a/src/ConfigPath.cxx +++ b/src/ConfigPath.cxx @@ -22,6 +22,7 @@ #include "fs/AllocatedPath.hxx" #include "fs/Traits.hxx" #include "fs/Domain.hxx" +#include "fs/StandardDirectory.hxx" #include "util/Error.hxx" #include "ConfigGlobal.hxx" @@ -39,14 +40,14 @@ static AllocatedPath GetHome(const char *user, Error &error) { - passwd *pw = getpwnam(user); - if (pw == nullptr) { + AllocatedPath result = GetHomeDir(user); + if (result.IsNull()) { error.Format(path_domain, "no such user: %s", user); return AllocatedPath::Null(); } - return AllocatedPath::FromFS(pw->pw_dir); + return result; } /** @@ -55,14 +56,14 @@ GetHome(const char *user, Error &error) static AllocatedPath GetHome(Error &error) { - const char *home = g_get_home_dir(); - if (home == nullptr) { + AllocatedPath result = GetHomeDir(); + if (result.IsNull()) { error.Set(path_domain, "problems getting home for current user"); return AllocatedPath::Null(); } - return AllocatedPath::FromUTF8(home, error); + return result; } /** |