2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
5 * This conforms with the freedesktop.org XDG Base Directory Specification version 0.6
7 * The policy here is to add extra directories to the possible search paths to
8 * cater for quirks of different OS's. It doesn't take long to eliminate an
9 * excess directory from the paths.
14 #include "Ecore_Desktop.h"
15 #include "ecore_desktop_private.h"
22 /* This really slows things down and no doubt drags in some KDE bloat at start up.
23 * To work around this, I add a few extra things to try in the _ecore_desktop_paths_get()
29 /* This is nowhere near as bloated and slow as the KDE stuff, but worthwhile
30 * making it optional anyway.
32 #define GNOME_SUPPORT 1
35 /* FIXME: remove those two defines, preload a cache with the guesses, whenever
36 * we have a few seconds of idle time, run the gnome and kde config proggies
37 * and correct those guesses.
40 Ecore_List *ecore_desktop_paths_config = NULL;
41 Ecore_List *ecore_desktop_paths_menus = NULL;
42 Ecore_List *ecore_desktop_paths_directories = NULL;
43 Ecore_List *ecore_desktop_paths_desktops = NULL;
44 Ecore_List *ecore_desktop_paths_icons = NULL;
45 Ecore_List *ecore_desktop_paths_kde_legacy = NULL;
46 Ecore_List *ecore_desktop_paths_xsessions = NULL;
49 static Ecore_List *_ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type,
50 const char *before, const char *env_home,
51 const char *env, const char *env_home_default,
52 const char *env_default, const char *type,
53 const char *gnome_extra, const char *kde);
54 static void _ecore_desktop_paths_massage_path(char *path, char *home,
57 static void _ecore_desktop_paths_check_and_add(Ecore_List * paths,
59 static void _ecore_desktop_paths_create(void);
60 static void _ecore_desktop_paths_destroy(void);
62 static Ecore_List *gnome_data = NULL;
63 static Ecore_List *prepend_user_paths[ECORE_DESKTOP_PATHS_MAX];
64 static Ecore_List *prepend_system_paths[ECORE_DESKTOP_PATHS_MAX];
65 static Ecore_List *append_user_paths[ECORE_DESKTOP_PATHS_MAX];
66 static Ecore_List *append_system_paths[ECORE_DESKTOP_PATHS_MAX];
68 static int init_count = 0;
70 #if defined GNOME_SUPPORT || defined KDE_SUPPORT
71 struct _config_exe_data
74 Ecore_List *paths, *types;
78 static void _ecore_desktop_paths_exec_config(Ecore_List * paths,
83 static int _ecore_desktop_paths_cb_exe_exit(void *data, int type,
86 static Ecore_Event_Handler *exit_handler = NULL;
90 ecore_desktop_paths_init(void)
92 if (++init_count != 1)
95 #if defined GNOME_SUPPORT || defined KDE_SUPPORT
97 ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
98 _ecore_desktop_paths_cb_exe_exit, NULL);
101 ecore_desktop_paths_extras_clear();
102 gnome_data = ecore_list_new();
103 home = ecore_desktop_home_get();
110 ecore_list_free_cb_set(gnome_data, free);
111 _ecore_desktop_paths_exec_config(gnome_data, home, NULL,
112 "gnome-config --datadir");
115 Ecore_List *config_list;
117 config_list = ecore_desktop_paths_to_list("/opt/gnome/share");
123 ecore_list_first_goto(config_list);
124 while ((this_config = ecore_list_next(config_list)) != NULL)
127 _ecore_desktop_paths_massage_path(path, home,
129 _ecore_desktop_paths_check_and_add(gnome_data, path);
131 E_FN_DEL(ecore_list_destroy, config_list);
136 _ecore_desktop_paths_create();
141 ecore_desktop_paths_shutdown(void)
145 if (--init_count != 0)
148 for (i = 0; i < ECORE_DESKTOP_PATHS_MAX; i++)
150 E_FN_DEL(ecore_list_destroy, prepend_user_paths[i]);
151 E_FN_DEL(ecore_list_destroy, prepend_system_paths[i]);
152 E_FN_DEL(ecore_list_destroy, append_user_paths[i]);
153 E_FN_DEL(ecore_list_destroy, append_system_paths[i]);
156 _ecore_desktop_paths_destroy();
157 E_FN_DEL(ecore_list_destroy, gnome_data);
159 #if defined GNOME_SUPPORT || defined KDE_SUPPORT
161 ecore_event_handler_del(exit_handler);
168 ecore_desktop_paths_regen(void)
170 _ecore_desktop_paths_destroy();
171 _ecore_desktop_paths_create();
175 _ecore_desktop_paths_create(void)
177 if (!ecore_desktop_paths_desktops)
179 ecore_desktop_paths_desktops =
180 _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_DESKTOPS, NULL,
181 "XDG_DATA_HOME", "XDG_DATA_DIRS",
182 "~/.local/share:~/.kde/share",
183 "/usr/local/share:/usr/share",
184 // "applications:applnk:applications/kde",
185 "applications:applnk",
186 "dist/desktop-files:dist/short-menu:gnome/apps",
187 "xdgdata-apps:apps");
188 _ecore_desktop_paths_check_and_add(ecore_desktop_paths_desktops,
189 "/usr/local/share/update-desktop-files/templates");
190 _ecore_desktop_paths_check_and_add(ecore_desktop_paths_desktops,
191 "/usr/share/update-desktop-files/templates");
193 if (!ecore_desktop_paths_kde_legacy)
196 ecore_desktop_paths_kde_legacy =
197 _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_KDE_LEGACY, NULL, NULL,
198 NULL, NULL, NULL, NULL, NULL, "apps");
200 ecore_desktop_paths_kde_legacy =
201 _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_KDE_LEGACY, NULL,
202 "XDG_DATA_HOME", "XDG_DATA_DIRS",
203 "~/.local/share:~/.kde/share",
204 "/usr/local/share:/usr/share", "applnk",
207 if (ecore_desktop_paths_kde_legacy)
209 char temp[PATH_MAX], *path;
210 Ecore_List *temp_list;
212 /* Copy it, cause Ecore_List walks can not be nested. */
213 temp_list = ecore_list_new();
216 ecore_list_first_goto(ecore_desktop_paths_kde_legacy);
218 ecore_list_next(ecore_desktop_paths_kde_legacy)) !=
220 ecore_list_append(temp_list, path);
222 ecore_list_first_goto(temp_list);
223 while ((path = ecore_list_next(temp_list)) != NULL)
227 t1 = rindex(path, '/');
229 t2 = rindex(path, '/');
231 sprintf(temp, "%s/apps/kappfinder/apps/", path);
234 _ecore_desktop_paths_check_and_add
235 (ecore_desktop_paths_kde_legacy, temp);
238 ecore_list_destroy(temp_list);
241 if (!ecore_desktop_paths_icons)
245 ecore_desktop_paths_icons =
246 _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_ICONS, "~/.icons",
247 "XDG_DATA_HOME", "XDG_DATA_DIRS",
248 "~/.local/share:~/.kde/share",
249 "/usr/local/share:/usr/share:/usr/X11R6/share",
250 "icons:pixmaps", "dist/icons",
252 _ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons,
253 "/usr/local/share/pixmaps/");
254 _ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons,
255 "/usr/share/pixmaps/");
256 _ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons,
257 "/usr/share/update-desktop-files/kappfinder-icons/");
258 gnome = getenv("GNOME_ICON_PATH");
260 _ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons, gnome);
262 if (!ecore_desktop_paths_menus)
263 ecore_desktop_paths_menus =
264 _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_MENUS, NULL,
265 "XDG_CONFIG_HOME", "XDG_CONFIG_DIRS",
266 "~/.config", "/etc/xdg:/var/lib/menu-xdg",
267 "menus", NULL, "xdgconf-menu");
268 if (!ecore_desktop_paths_directories)
269 ecore_desktop_paths_directories =
270 _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_DIRECTORIES, NULL,
271 "XDG_DATA_HOME", "XDG_DATA_DIRS",
272 "~/.local/share:~/.kde/share",
273 "/usr/local/share:/usr/share",
274 "desktop-directories", "gnome/vfolders",
276 if (!ecore_desktop_paths_config)
277 ecore_desktop_paths_config =
278 _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_CONFIG, NULL,
279 "XDG_CONFIG_HOME", "XDG_CONFIG_DIRS",
280 "~/.config", "/etc/xdg", NULL, NULL, NULL);
281 if (!ecore_desktop_paths_xsessions)
282 ecore_desktop_paths_xsessions =
283 _ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_XSESSIONS, NULL,
284 "XDG_DATA_HOME", "XDG_DATA_DIRS",
285 "~/.local/share:~/.kde/share",
286 "/usr/local/share:/usr/share", "xsessions",
291 _ecore_desktop_paths_destroy(void)
293 E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_xsessions);
294 E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_config);
295 E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_directories);
296 E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_menus);
297 E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_icons);
298 E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_kde_legacy);
299 E_FN_DEL(ecore_list_destroy, ecore_desktop_paths_desktops);
303 ecore_desktop_paths_extras_clear(void)
307 for (i = 0; i < ECORE_DESKTOP_PATHS_MAX; i++)
309 E_FN_DEL(ecore_list_destroy, prepend_user_paths[i]);
310 E_FN_DEL(ecore_list_destroy, prepend_system_paths[i]);
311 E_FN_DEL(ecore_list_destroy, append_user_paths[i]);
312 E_FN_DEL(ecore_list_destroy, append_system_paths[i]);
313 prepend_user_paths[i] = ecore_list_new();
314 if (prepend_user_paths[i])
315 ecore_list_free_cb_set(prepend_user_paths[i], free);
316 prepend_system_paths[i] = ecore_list_new();
317 if (prepend_system_paths[i])
318 ecore_list_free_cb_set(prepend_system_paths[i], free);
319 append_user_paths[i] = ecore_list_new();
320 if (append_user_paths[i])
321 ecore_list_free_cb_set(append_user_paths[i], free);
322 append_system_paths[i] = ecore_list_new();
323 if (append_system_paths[i])
324 ecore_list_free_cb_set(append_system_paths[i], free);
329 ecore_desktop_paths_prepend_user(Ecore_Desktop_Paths_Type type, const char *paths)
331 if (prepend_user_paths[type])
332 ecore_list_append(prepend_user_paths[type], strdup(paths));
336 ecore_desktop_paths_prepend_system(Ecore_Desktop_Paths_Type type, const char *paths)
338 if (prepend_system_paths[type])
339 ecore_list_append(prepend_system_paths[type], strdup(paths));
343 ecore_desktop_paths_append_user(Ecore_Desktop_Paths_Type type, const char *paths)
345 if (append_user_paths[type])
346 ecore_list_append(append_user_paths[type], strdup(paths));
350 ecore_desktop_paths_append_system(Ecore_Desktop_Paths_Type type, const char *paths)
352 if (append_system_paths[type])
353 ecore_list_append(append_system_paths[type], strdup(paths));
356 /** Search for a file in fdo compatible locations.
358 * This will search through all the diretories of a particular type, looking
359 * for the file. It will recurse into subdirectories. If func is NULL, then
360 * only the first file found will be returned. If func is defined, then each
361 * file found will be passed to func, until func returns 1.
363 * The returned string will have to be freed eventually.
365 * @param type The type of directories to search.
366 * @param file The file to search for.
367 * @param sub Levels of sub directories to search, -1 = all, 0 = none.
368 * @param func A function to call for each file found.
369 * @param data A pointer to pass on to func.
372 ecore_desktop_paths_file_find(Ecore_List * paths, const char *file, int sub,
373 int (*func) (void *data, const char *path),
376 char *path = NULL, *this_path;
378 struct stat path_stat;
380 if (!paths) return NULL;
381 ecore_list_first_goto(paths);
382 while ((this_path = ecore_list_next(paths)) != NULL)
389 snprintf(temp, PATH_MAX, "%s%s", this_path, file);
390 if (stat(temp, &path_stat) == 0)
393 if ((func) && (func(data, temp)))
398 ecore_desktop_paths_recursive_search(this_path, file, sub,
408 config file full of paths
416 _ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type,
417 const char *before, const char *env_home, const char *env,
418 const char *env_home_default, const char *env_default, const char *type,
419 const char *gnome_extra, const char *kde)
421 Ecore_List *paths = NULL;
422 Ecore_List *types = NULL;
423 Ecore_List *gnome_extras = NULL;
425 Ecore_List *env_list;
429 Ecore_List *kdes = NULL;
432 paths = ecore_list_new();
433 if (!paths) return NULL;
434 ecore_list_free_cb_set(paths, free);
435 /* Don't sort them, as they are in preferred order from each source. */
436 /* Merge the results, there are probably some duplicates. */
439 types = ecore_desktop_paths_to_list(type);
441 gnome_extras = ecore_desktop_paths_to_list(gnome_extra);
444 kdes = ecore_desktop_paths_to_list(kde);
453 befores = ecore_desktop_paths_to_list(before);
458 ecore_list_first_goto(befores);
459 while ((this_before = ecore_list_next(befores)) != NULL)
461 _ecore_desktop_paths_massage_path(path, home,
463 _ecore_desktop_paths_check_and_add(paths, path);
465 E_FN_DEL(ecore_list_destroy, befores);
469 if (prepend_user_paths[path_type])
473 ecore_list_first_goto(prepend_user_paths[path_type]);
474 while ((this_path = ecore_list_next(prepend_user_paths[path_type])) != NULL)
476 _ecore_desktop_paths_massage_path(path, home, this_path, NULL);
477 _ecore_desktop_paths_check_and_add(paths, path);
485 value = getenv(env_home);
486 if ((value == NULL) || (value[0] == '\0'))
487 value = env_home_default;
488 env_list = ecore_desktop_paths_to_list(value);
493 ecore_list_first_goto(env_list);
494 while ((this_env = ecore_list_next(env_list)) != NULL)
500 ecore_list_first_goto(types);
501 while ((this_type = ecore_list_next(types)) != NULL)
503 _ecore_desktop_paths_massage_path(path, home,
504 this_env, this_type);
505 _ecore_desktop_paths_check_and_add(paths, path);
510 _ecore_desktop_paths_massage_path(path, home, this_env, NULL);
511 _ecore_desktop_paths_check_and_add(paths, path);
514 E_FN_DEL(ecore_list_destroy, env_list);
518 if (append_user_paths[path_type])
522 ecore_list_first_goto(append_user_paths[path_type]);
523 while ((this_path = ecore_list_next(append_user_paths[path_type])) != NULL)
525 _ecore_desktop_paths_massage_path(path, home, this_path, NULL);
526 _ecore_desktop_paths_check_and_add(paths, path);
530 if (prepend_system_paths[path_type])
534 ecore_list_first_goto(prepend_system_paths[path_type]);
535 while ((this_path = ecore_list_next(prepend_system_paths[path_type])) != NULL)
537 _ecore_desktop_paths_massage_path(path, home, this_path, NULL);
538 _ecore_desktop_paths_check_and_add(paths, path);
547 if ((value == NULL) || (value[0] == '\0'))
549 env_list = ecore_desktop_paths_to_list(value);
554 ecore_list_first_goto(env_list);
555 while ((this_env = ecore_list_next(env_list)) != NULL)
561 ecore_list_first_goto(types);
562 while ((this_type = ecore_list_next(types)) != NULL)
564 _ecore_desktop_paths_massage_path(path, home,
565 this_env, this_type);
566 _ecore_desktop_paths_check_and_add(paths, path);
571 _ecore_desktop_paths_massage_path(path, home, this_env, NULL);
572 _ecore_desktop_paths_check_and_add(paths, path);
575 E_FN_DEL(ecore_list_destroy, env_list);
579 if (append_system_paths[path_type])
583 ecore_list_first_goto(append_system_paths[path_type]);
584 while ((this_path = ecore_list_next(append_system_paths[path_type])) != NULL)
586 _ecore_desktop_paths_massage_path(path, home, this_path, NULL);
587 _ecore_desktop_paths_check_and_add(paths, path);
592 * Get the pathlist from the config file - type=pathlist
593 * for each path in config
594 * if it is already in paths, skip it
595 * if it exists, add it to end of paths
602 ecore_list_first_goto(gnome_data);
603 while ((this_gnome = ecore_list_next(gnome_data)) != NULL)
609 ecore_list_first_goto(types);
610 while ((this_type = ecore_list_next(types)) != NULL)
612 _ecore_desktop_paths_massage_path(path, home,
613 this_gnome, this_type);
614 _ecore_desktop_paths_check_and_add(paths, path);
619 _ecore_desktop_paths_massage_path(path, home, this_gnome, NULL);
620 _ecore_desktop_paths_check_and_add(paths, path);
624 if (gnome_data && gnome_extras)
626 char *this_gnome, *this_type;
628 ecore_list_first_goto(gnome_data);
629 while ((this_gnome = ecore_list_next(gnome_data)) != NULL)
631 ecore_list_first_goto(gnome_extras);
632 while ((this_type = ecore_list_next(gnome_extras)) != NULL)
634 _ecore_desktop_paths_massage_path(path, home,
635 this_gnome, this_type);
636 _ecore_desktop_paths_check_and_add(paths, path);
642 if ((exit_handler != NULL) && (kdes != NULL))
646 ecore_list_first_goto(kdes);
647 while ((this_kde = ecore_list_next(kdes)) != NULL)
651 sprintf(cmd, "kde-config --path %s", this_kde);
652 _ecore_desktop_paths_exec_config(paths, home, NULL, cmd);
658 E_FN_DEL(ecore_list_destroy, kdes);
660 E_FN_DEL(ecore_list_destroy, gnome_extras);
661 E_FN_DEL(ecore_list_destroy, types);
667 _ecore_desktop_paths_massage_path(char *path, char *home, char *first,
672 /* Strip traling slash of first. */
673 last = strlen(first) - 1;
674 while ((last >= 0) && (first[last] == '/'))
682 /* Strip traling slash of second. */
683 last = strlen(second) - 1;
684 while ((last >= 0) && (second[last] == '/'))
691 if ((second) && (second[0] != '\0'))
694 sprintf(path, "%s%s/%s/", home, &first[1],
695 &second[(second[0] == '/') ? 1 : 0]);
697 sprintf(path, "%s/%s/", first, &second[(second[0] == '/') ? 1 : 0]);
702 sprintf(path, "%s%s/", home, &first[1]);
704 sprintf(path, "%s/", first);
709 _ecore_desktop_paths_check_and_add(Ecore_List * paths, const char *path)
711 struct stat path_stat;
716 /* Check if we have it already. */
717 ecore_list_first_goto(paths);
718 while ((this_path = ecore_list_next(paths)) != NULL)
720 if (strcmp(path, this_path) == 0)
724 /* Check if the path exists. */
725 if ((stat(path, &path_stat) == 0) && (S_ISDIR(path_stat.st_mode)))
726 ecore_list_append(paths, strdup(path));
730 ecore_desktop_paths_recursive_search(const char *path, const char *file,
731 int sub, int (*dir_func) (void *data,
734 int (*func) (void *data, const char *path),
739 struct dirent *script;
741 if ((sub != 0) && (sub != -1))
745 if (!dir) return NULL;
747 while ((script = readdir(dir)) != NULL)
749 struct stat script_stat;
750 char info_text[PATH_MAX];
752 sprintf(info_text, "%s%s", path, script->d_name);
753 if ((stat(info_text, &script_stat) == 0))
755 if (S_ISDIR(script_stat.st_mode))
757 if ((strcmp(basename(info_text), ".") != 0) &&
758 (strcmp(basename(info_text), "..") != 0))
760 snprintf(info_text, PATH_MAX, "%s%s/", path, script->d_name);
761 if ((dir_func) && (dir_func(data, info_text)))
765 if (fpath) free(fpath);
767 ecore_desktop_paths_recursive_search(info_text, file, sub,
768 dir_func, func, data);
776 if (strcmp(basename(info_text), file) == 0)
780 fpath = strdup(info_text);
781 if ((func) && (func(data, path)))
787 if ((func) && (func(data, info_text)))
791 if (fpath && (!func))
800 #if defined GNOME_SUPPORT || defined KDE_SUPPORT
802 _ecore_desktop_paths_exec_config(Ecore_List * paths, char *home,
803 Ecore_List * extras, char *cmd)
806 struct _config_exe_data ced;
813 ecore_exe_pipe_run(cmd,
814 ECORE_EXE_PIPE_AUTO | ECORE_EXE_PIPE_READ |
815 ECORE_EXE_PIPE_READ_LINE_BUFFERED, &ced);
818 ecore_exe_tag_set(exe, "genmenu/fdo");
819 while (ced.done == 0)
821 /* FIXME: raster is paranoid. If too much time passes, give up.
822 * Or find a way to let the usual event loop shit do this without
823 * spinning our wheels. On the other hand, these are quick
824 * commands, and we NEED this data before we can continue. On
825 * the gripping hand, some tweaking of the stuff searched for not
826 * only gets rid of the need for this, but also speeds things up
829 ecore_main_loop_iterate();
836 _ecore_desktop_paths_cb_exe_exit(void *data, int type, void *event)
838 Ecore_Exe_Event_Del *ev;
840 Ecore_List *config_list;
841 Ecore_Exe_Event_Data *read;
842 struct _config_exe_data *ced;
849 value = ecore_exe_tag_get(ev->exe);
850 if ((!value) || (strcmp(value, "genmenu/fdo")) != 0)
852 ced = ecore_exe_data_get(ev->exe);
859 read = ecore_exe_event_data_get(ev->exe, ECORE_EXE_PIPE_READ);
860 if ((read) && (read->lines[0].line))
862 value = read->lines[0].line;
863 config_list = ecore_desktop_paths_to_list(value);
866 char *this_config, *this_type;
868 ecore_list_first_goto(config_list);
869 while ((this_config = ecore_list_next(config_list)) != NULL)
873 ecore_list_first_goto(ced->types);
875 ecore_list_next(ced->types)) != NULL)
877 _ecore_desktop_paths_massage_path(path,
881 _ecore_desktop_paths_check_and_add(paths,
887 _ecore_desktop_paths_massage_path(path, ced->home,
890 _ecore_desktop_paths_check_and_add(paths, path);
893 E_FN_DEL(ecore_list_destroy, config_list);
901 /** Split a list of paths into an Ecore_Hash.
903 * The list of paths can use any one of ;:, to seperate the paths.
904 * You can also escape the :;, with \.
906 * @param paths A list of paths.
909 ecore_desktop_paths_to_hash(const char *paths)
913 char buf[PATH_MAX], *p, *pp;
915 if (!paths) return NULL;
916 result = ecore_hash_new(ecore_str_hash, ecore_str_compare);
917 if (!result) return NULL;
918 ecore_hash_free_key_cb_set(result, free);
919 ecore_hash_free_value_cb_set(result, free);
921 path = strdup(paths);
930 /* Check for escape */
933 /* If separator, skip escape */
934 if ((*(p + 1) == ';') || (*(p + 1) == ':') || (*(p + 1) == ','))
937 /* Check for separator */
938 else if ((*p == ';') || (*p == ':') || (*p == ','))
945 if (*buf) ecore_hash_set(result, strdup(buf), strdup(buf));
954 /** Split a list of paths into an Ecore_Hash.
956 * The list of paths can use any one of ;:, to seperate the paths.
957 * You can also escape the :;, with \.
959 * @param paths A list of paths.
962 ecore_desktop_paths_to_list(const char *paths)
966 char buf[PATH_MAX], *p, *pp;
968 if (!paths) return NULL;
969 result = ecore_list_new();
970 if (!result) return NULL;
971 ecore_list_free_cb_set(result, free);
973 path = strdup(paths);
982 /* Check for escape */
985 /* If separator, skip escape */
986 if ((*(p + 1) == ';') || (*(p + 1) == ':') || (*(p + 1) == ','))
989 /* Check for separator */
990 else if ((*p == ';') || (*p == ':') || (*p == ','))
997 if (*buf) ecore_list_append(result, strdup(buf));
1007 ecore_desktop_paths_for_each(Ecore_Desktop_Paths_Type type,
1008 Ecore_For_Each function, void *user_data)
1010 Ecore_List *list = NULL;
1014 case ECORE_DESKTOP_PATHS_CONFIG:
1015 list = ecore_desktop_paths_config;
1017 case ECORE_DESKTOP_PATHS_MENUS:
1018 list = ecore_desktop_paths_menus;
1020 case ECORE_DESKTOP_PATHS_DIRECTORIES:
1021 list = ecore_desktop_paths_directories;
1023 case ECORE_DESKTOP_PATHS_DESKTOPS:
1024 list = ecore_desktop_paths_desktops;
1026 case ECORE_DESKTOP_PATHS_ICONS:
1027 list = ecore_desktop_paths_icons;
1029 case ECORE_DESKTOP_PATHS_KDE_LEGACY:
1030 list = ecore_desktop_paths_kde_legacy;
1032 case ECORE_DESKTOP_PATHS_XSESSIONS:
1033 list = ecore_desktop_paths_xsessions;
1035 case ECORE_DESKTOP_PATHS_MAX:
1039 return ecore_list_for_each(list, function, user_data);