Fixed user home directory getting

pull/7/head
parent 338d8dca55
commit 7b666aafe6

@ -802,7 +802,11 @@ char *yon_ubl_root_user_get(){
} }
char *yon_ubl_user_get_home_directory(){ 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 // parsing functions

@ -9,6 +9,8 @@
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h>
#include <pwd.h>
#include <locale.h> #include <locale.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gtk/gtkx.h> #include <gtk/gtkx.h>
@ -24,6 +26,7 @@
#define new(type) malloc(sizeof(type)) #define new(type) malloc(sizeof(type))
#define new_arr(type,size) malloc(sizeof(type)*size) #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 typedef enum
{ {

Loading…
Cancel
Save