int main(int argc, char **argv) { Eina_Iterator *it; const char *f_name; const Eina_File_Direct_Info *f_info; eina_init(); eina_file_dir_list("/home/", EINA_FALSE, _print_cb, NULL); it = eina_file_ls("/home/"); EINA_ITERATOR_FOREACH(it, f_name) { printf("%s\n", f_name); eina_stringshare_del(f_name); }
EAPI Eina_Array *eina_module_arch_list_get(Eina_Array *array, const char *path, const char *arch) { Dir_List_Get_Cb_Data list_get_cb_data; if ((!path) || (!arch)) return array; list_get_cb_data.array = array ? array : eina_array_new(4); list_get_cb_data.cb = NULL; list_get_cb_data.data = (void *)arch; eina_file_dir_list(path, 0, &_dir_arch_list_cb, &list_get_cb_data); return list_get_cb_data.array; }
/** * @brief Get a list of modules found on the directory path. * * @param array The array that stores the list of the modules. * @param path The directory's path to search for modules. * @param recursive Iterate recursively on the path. * @param cb Callback function to call on each module. * @param data Data passed to the callback function. * * This function adds to @p array the list of modules found in * @p path. If @p recursive is #EINA_TRUE, then recursive search is * done. The callback @p cb is called on each module found, and @p data * is passed to @p cb. If @p path is @c NULL, the function returns * immediately @p array. If the returned value of @p cb is 0, the * module will not be added to the list, otherwise it will be added. * @p array can be @c NULL. In that case, it is created with 4 * elements. @p cb can be @c NULL. */ EAPI Eina_Array *eina_module_list_get(Eina_Array * array, const char *path, Eina_Bool recursive, Eina_Module_Cb cb, void *data) { Dir_List_Get_Cb_Data list_get_cb_data; Dir_List_Cb_Data list_cb_data; if (!path) return array; list_get_cb_data.array = array ? array : eina_array_new(4); list_get_cb_data.cb = cb; list_get_cb_data.data = data; list_cb_data.cb = &_dir_list_get_cb; list_cb_data.data = &list_get_cb_data; eina_file_dir_list(path, recursive, &_dir_list_cb, &list_cb_data); return list_get_cb_data.array; }