void readlist(void) { GDir *confdir = 0; const gchar *dirname; struct list_elem *list_item; free_appsync_list(); if( !(confdir = g_dir_open(CONF_DIR_PATH, 0, NULL)) ) goto cleanup; while( (dirname = g_dir_read_name(confdir)) ) { log_debug("Read file %s\n", dirname); if( (list_item = read_file(dirname)) ) sync_list = g_list_append(sync_list, list_item); } cleanup: if( confdir ) g_dir_close(confdir); /* set up session bus connection if app sync in use * so we do not need to make the time consuming connect * operation at enumeration time ... */ if( sync_list ) { log_debug("Sync list valid\n"); #ifdef APP_SYN_DBUS usb_moded_app_sync_init_connection(); #endif } }
void readlist(int diag) { GDir *confdir = 0; const gchar *dirname; struct list_elem *list_item; free_appsync_list(); if(diag) { if( !(confdir = g_dir_open(CONF_DIR_DIAG_PATH, 0, NULL)) ) goto cleanup; } else { if( !(confdir = g_dir_open(CONF_DIR_PATH, 0, NULL)) ) goto cleanup; } while( (dirname = g_dir_read_name(confdir)) ) { log_debug("Read file %s\n", dirname); if( (list_item = read_file(dirname, diag)) ) sync_list = g_list_append(sync_list, list_item); } cleanup: if( confdir ) g_dir_close(confdir); /* sort list alphabetically so services for a mode can be run in a certain order */ sync_list=g_list_sort(sync_list, list_sort_func); /* set up session bus connection if app sync in use * so we do not need to make the time consuming connect * operation at enumeration time ... */ if( sync_list ) { log_debug("Sync list valid\n"); #ifdef APP_SYN_DBUS usb_moded_app_sync_init_connection(); #endif } }