If opened repo folder already has repo, its packages will be loaded too

pull/30/head
parent 06b559ecbe
commit cb6dfd61a6

@ -408,7 +408,38 @@ void on_repo_add_new(GtkWidget *self, dictionary *dict){
name = window->path;
if (!name||strcmp(name,"")!=0){
GtkTreeIter *iter = yon_repo_append(widgets, name, YON_REPO_LINE_REPO_TYPE);
gtk_tree_store_set(main_config.tree_store,iter,0,folder_added,2,window->path,3,1,-1);
struct dirent *de;
GtkTreeIter child;
char *reponame = yon_char_new(name);
yon_char_divide(reponame,yon_char_find_last(reponame,'/'));
char *searchpath = yon_char_unite(name,"/",reponame,"/x86_64/",NULL);
DIR *directory = opendir(searchpath);
if (directory){
while ((de = readdir(directory)))
{
if (strstr(de->d_name,"pkg.tar.")&&!strstr(de->d_name,".sig")){
char *filename = yon_char_unite(searchpath,"/",de->d_name,NULL);
FILE *file = popen(get_package_info_command(filename),"r");
char *cur_string=g_malloc0(sizeof(char)*4096);
char *packname=NULL, *packver=NULL, *packarch=NULL, *packdepends=NULL;
while (fgets(cur_string,4096,file)){
char *stringe = yon_char_divide_search(cur_string,"\n",-1);
char *p = yon_char_divide_search(stringe,":",-1);
if (strstr(p,"Name")) packname = yon_char_new(stringe);
else if (strstr(p,"Version")) packver = yon_char_new(stringe);
else if (strstr(p,"Architecture")) packarch = yon_char_new(stringe);
else if (strstr(p,"Depends On")) packdepends = yon_char_new(stringe);
else if (strstr(p,"Depends On")) packdepends = yon_char_new(stringe);
}
gtk_tree_store_append(main_config.tree_store,&child,iter);
gtk_tree_store_set(main_config.tree_store,&child,0,document_no_edits,1,yon_char_unite(packname,"-",packver,"-",packarch,NULL),2,filename,3,0,9,packname,10,packver,11,packarch,12,packdepends,-1);
}
}
gtk_tree_store_set(main_config.tree_store,iter,0,folder_no_edits,2,window->path,3,0,9,reponame,-1);
} else {
gtk_tree_store_set(main_config.tree_store,iter,0,folder_added,2,window->path,3,1,9,reponame,-1);
}
yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
} else {
yon_ubl_status_box_render(EMPTY_NAME_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);

Loading…
Cancel
Save