/** * Returns a list of .menu files found in the various config dirs. * @return An eina list of menu file paths (const char *). This must be freed with EINA_LIST_FREE. */ EAPI Eina_List * efreet_util_menus_find(void) { Eina_List *menus = NULL; Eina_List *dirs, *l; const char *dir; menus = efreet_util_menus_find_helper(menus, efreet_config_home_get()); dirs = efreet_config_dirs_get(); EINA_LIST_FOREACH(dirs, l, dir) menus = efreet_util_menus_find_helper(menus, dir); return menus; }
static void _print_config_dirs(void) { const Eina_List *itr, *lst = efreet_config_dirs_get(); const char *s; Eina_Bool first = EINA_TRUE; EINA_LIST_FOREACH(lst, itr, s) { if (first) first = EINA_FALSE; else putchar(':'); fputs(s, stdout); } }
int ef_cb_efreet_config_dirs(void) { Eina_List *tmp, *l; int ret = 1; unsigned int i; unsigned int ok; char dirs[128], *val; char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL}; char *def_vals[] = {"/etc/xdg", NULL}; dirs[0] = '\0'; for (i = 0; vals[i]; i++) { if (i > 0) strcat(dirs, ":"); strcat(dirs, vals[i]); } efreet_shutdown(); setenv("XDG_CONFIG_DIRS", dirs, 1); efreet_init(); ok = 0; tmp = efreet_config_dirs_get(); for (i = 0; vals[i]; i++) { char *found; found = eina_list_search_unsorted(tmp, EINA_COMPARE_CB(strcmp), vals[i]); if (!ecore_file_exists(vals[i]) && found) { printf("efreet_data_dirs_get() includes non-existing dir (%s) when " "%s set\n", vals[i], dirs); ret = 0; continue; } if (ecore_file_exists(vals[i]) && !found) { printf("efreet_data_dirs_get() is missing dir (%s) when " "%s set\n", vals[i], dirs); ret = 0; continue; } if (ecore_file_exists(vals[i]) && found) ok++; } if (eina_list_count(tmp) != ok) { printf("efreet_data_dirs_get() returned more values then it " "should have given %s as input\n", dirs); ret = 0; } efreet_shutdown(); unsetenv("XDG_CONFIG_DIRS"); efreet_init(); i = 0; tmp = efreet_config_dirs_get(); EINA_LIST_FOREACH(tmp, l, val) { if (!def_vals[i]) { printf("efreet_config_dirs_get() returned more values then it " "should have given %s as input\n", dirs); ret = 0; break; } if (strcmp(val, def_vals[i])) { printf("efreet_config_dirs_get() returned incorrect value (%s) when " "XDG_CONFIG_DIRS= is set\n", val); ret = 0; } i++; } return ret; }