efreetd - fix loading of extra_icons.dirs and icon.exts to not lose char

efreetd was losing the last char on every line of extra_icon.dirs and
icon.exts thus resulting in gradual degredation of these files as more
and more changes happen to have things like:

.jpeg
.jpe
.jp
.j
.

etc. for extension or dirs like

/home/raster/.e/e/icons
/home/raster/.e/e/icon
/home/raster/.e/e/ico
...
/home/ras
/home/ra
/home/r
...
/ho
/h
/

.. you get the idea. before long the list of extra icon dirs (and
extensions) was massigve and caued all sorts of filesystem rummaging.
this fixes that to no longer degrade these files. this also changes
their names to force new files to be used instead of the broken old
ones.
This commit is contained in:
Carsten Haitzler 2015-04-13 09:38:35 +09:00
parent 6b493430df
commit e05eb13f70
1 changed files with 8 additions and 8 deletions

View File

@ -677,8 +677,8 @@ fill_list(const char *file, Eina_List **l)
{
if (line->end > line->start)
{
const char *end = line->end - 1;
*l = eina_list_append(*l, eina_stringshare_add_length(line->start, end - line->start));
const char *s = eina_stringshare_add_length(line->start, line->end - line->start);
if (s) *l = eina_list_append(*l, s);
}
}
eina_iterator_free(it);
@ -689,9 +689,9 @@ error:
static void
read_lists(void)
{
fill_list("extra_desktop.dirs", &desktop_extra_dirs);
fill_list("extra_icon.dirs", &icon_extra_dirs);
fill_list("icon.exts", &icon_exts);
fill_list("extra_desktops.dirs", &desktop_extra_dirs);
fill_list("extra_icons.dirs", &icon_extra_dirs);
fill_list("icons.exts", &icon_exts);
}
static void
@ -777,7 +777,7 @@ cache_desktop_dir_add(const char *dir)
{
/* Not a registered path */
desktop_extra_dirs = eina_list_append(desktop_extra_dirs, eina_stringshare_add(san));
save_list("extra_desktop.dirs", desktop_extra_dirs);
save_list("extra_desktops.dirs", desktop_extra_dirs);
cache_desktop_update();
}
free(san);
@ -794,7 +794,7 @@ cache_icon_dir_add(const char *dir)
{
if (!strcmp(san, "/")) goto out;
icon_extra_dirs = eina_list_append(icon_extra_dirs, eina_stringshare_add(san));
save_list("extra_icon.dirs", icon_extra_dirs);
save_list("extra_icons.dirs", icon_extra_dirs);
cache_icon_update(EINA_TRUE);
}
out:
@ -807,7 +807,7 @@ cache_icon_ext_add(const char *ext)
if (!eina_list_search_unsorted_list(icon_exts, EINA_COMPARE_CB(strcmp), ext))
{
icon_exts = eina_list_append(icon_exts, eina_stringshare_add(ext));
save_list("icon.exts", icon_exts);
save_list("icons.exts", icon_exts);
cache_icon_update(EINA_TRUE);
}
}