From 6d69f2cd7f4704c17f5e2e8143e1fe4bc03202b6 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 18 Dec 2007 01:42:08 +0000 Subject: [PATCH] allow relative path for icon files in .desktops SVN revision: 33174 --- src/bin/e_fm.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 24b1ae20d..55fee072b 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -1108,11 +1108,43 @@ e_fm2_icon_get(Evas *evas, E_Fm2_Icon *ic, if (ic->info.icon) { /* custom icon */ - if (ic->info.icon[0] == '/') + if ((ic->info.icon[0] == '/') || + (!strncmp(ic->info.icon, "./", 2)) || + (!strncmp(ic->info.icon, "../", 3))) { + char *icfile = NULL; + /* path to icon file */ + icfile = ic->info.icon; + if (!strncmp(ic->info.icon, "./", 2)) + { + /* relative path */ + snprintf(buf, sizeof(buf), "%s/%s", + e_fm2_real_path_get(ic->info.fm), + ic->info.icon + 2); + icfile = buf; + } + else if (!strncmp(ic->info.icon, "../", 3)) + { + char *dirpath; + + /* relative path - parent */ + dirpath = strdup(e_fm2_real_path_get(ic->info.fm)); + if (dirpath) + { + p = strrchr(dirpath, '/'); + if (p) + { + *p = 0; + snprintf(buf, sizeof(buf), "%s/%s", dirpath, + ic->info.icon + 3); + icfile = buf; + } + free(dirpath); + } + } p = strrchr(ic->info.icon, '.'); - if ((p) && (!strcmp(p, ".edj"))) + if ((p) && (!strcasecmp(p, ".edj"))) { oic = edje_object_add(evas); if (!edje_object_file_set(oic, ic->info.icon, "icon"))