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:
parent
db849d1eed
commit
d4638834f8
10
src/utils.c
10
src/utils.c
@ -134,14 +134,12 @@ char *parsePath(char *path)
|
||||
|
||||
home = passwd->pw_dir;
|
||||
} else {
|
||||
struct passwd *passwd = getpwuid(geteuid());
|
||||
if (!passwd) {
|
||||
g_warning("problems getting passwd "
|
||||
"entry for current user");
|
||||
home = g_get_home_dir();
|
||||
if (home == NULL) {
|
||||
g_warning("problems getting home "
|
||||
"for current user");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
home = passwd->pw_dir;
|
||||
}
|
||||
} else {
|
||||
bool foundSlash = false;
|
||||
|
Loading…
Reference in New Issue
Block a user