utils: use g_get_home_dir()

Use g_get_home_dir() to get the home directory of the current user.
This will be portable to win32.
This commit is contained in:
Max Kellermann 2008-12-29 17:42:49 +01:00
parent db849d1eed
commit d4638834f8

View File

@ -134,14 +134,12 @@ char *parsePath(char *path)
home = passwd->pw_dir; home = passwd->pw_dir;
} else { } else {
struct passwd *passwd = getpwuid(geteuid()); home = g_get_home_dir();
if (!passwd) { if (home == NULL) {
g_warning("problems getting passwd " g_warning("problems getting home "
"entry for current user"); "for current user");
return NULL; return NULL;
} }
home = passwd->pw_dir;
} }
} else { } else {
bool foundSlash = false; bool foundSlash = false;