aboutsummaryrefslogtreecommitdiffstats
path: root/src/ConfigPath.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/ConfigPath.cxx')
-rw-r--r--src/ConfigPath.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/ConfigPath.cxx b/src/ConfigPath.cxx
index b88de3934..a2d7c2bb4 100644
--- a/src/ConfigPath.cxx
+++ b/src/ConfigPath.cxx
@@ -22,11 +22,10 @@
#include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx"
#include "fs/Domain.hxx"
+#include "fs/StandardDirectory.hxx"
#include "util/Error.hxx"
#include "ConfigGlobal.hxx"
-#include <glib.h>
-
#include <assert.h>
#include <string.h>
@@ -39,14 +38,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 +54,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;
}
/**
@@ -119,7 +118,7 @@ ParsePath(const char *path, Error &error)
return AllocatedPath::Null();
return AllocatedPath::Build(home, path2);
- } else if (!PathTraits::IsAbsoluteUTF8(path)) {
+ } else if (!PathTraitsUTF8::IsAbsolute(path)) {
error.Format(path_domain,
"not an absolute path: %s", path);
return AllocatedPath::Null();