diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 482d1e8..dbca61e 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -802,7 +802,11 @@ char *yon_ubl_root_user_get(){ } char *yon_ubl_user_get_home_directory(){ - return getenv("HOME"); + FILE *path = popen(get_home_dir_command,"r"); + char *ret = g_malloc(4096); + fgets(ret,4096,path); + ret=yon_char_divide_search(ret,"\n",-1); + return ret; } // parsing functions diff --git a/source/ubl-utils.h b/source/ubl-utils.h index a7394ea..d92f7c2 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include #include @@ -24,6 +26,7 @@ #define new(type) malloc(sizeof(type)) #define new_arr(type,size) malloc(sizeof(type)*size) +#define get_home_dir_command yon_char_unite("getent passwd \"",yon_ubl_root_user_get(),"\" | cut -d: -f6",NULL) typedef enum {