summaryrefslogtreecommitdiff
path: root/src/bin/e_path.c
diff options
context:
space:
mode:
authorhandyande <handyande>2005-06-06 10:37:15 +0000
committerhandyande <handyande@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2005-06-06 10:37:15 +0000
commitef23779c2bec733c43effbe15f0c40a904f05ef1 (patch)
tree30ad56a4c877ee606685fae83769775f1dd6e261 /src/bin/e_path.c
parentd5f8d839ee630c661306d0db6c5397d839e7d0ca (diff)
Add a path for the PATH environment, then use it to fix the ugly system(which...) hack
SVN revision: 15161
Diffstat (limited to 'src/bin/e_path.c')
-rw-r--r--src/bin/e_path.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/bin/e_path.c b/src/bin/e_path.c
index b67eea3..e3a16d2 100644
--- a/src/bin/e_path.c
+++ b/src/bin/e_path.c
@@ -18,6 +18,40 @@ e_path_new(void)
18 return ep; 18 return ep;
19} 19}
20 20
21E_Path *
22e_path_from_env(char *env)
23{
24 E_Path *ep;
25 char *env_path, *p, *last;
26
27 ep = e_path_new();
28 env_path = getenv(env);
29
30 if (!env_path)
31 return ep;
32 printf("need to add all parts of %s\n", env_path);
33
34 env_path = strdup(env_path);
35 last = env_path;
36 for (p = env_path; *p; p++)
37 {
38 if (*p == ':')
39 *p = '\0';
40
41 if (!*p)
42 {
43 e_path_default_path_append(ep, last);
44 last = p+1;
45 }
46
47 }
48 if (p > last)
49 e_path_default_path_append(ep, last);
50
51 free(env_path);
52 return ep;
53}
54
21void 55void
22e_path_default_path_append(E_Path *ep, const char *path) 56e_path_default_path_append(E_Path *ep, const char *path)
23{ 57{
@@ -352,12 +386,16 @@ e_path_dir_list_get(E_Path *ep)
352 new_epd->dir = strdup(epd->dir); 386 new_epd->dir = strdup(epd->dir);
353 dir_list = evas_list_append(dir_list, new_epd); 387 dir_list = evas_list_append(dir_list, new_epd);
354 } 388 }
355 for (l = *(ep->user_dir_list); l; l = l->next) 389
390 if (ep->user_dir_list)
356 { 391 {
357 epd = l->data; 392 for (l = *(ep->user_dir_list); l; l = l->next)
358 new_epd = malloc(sizeof(E_Path_Dir)); 393 {
359 new_epd->dir = strdup(epd->dir); 394 epd = l->data;
360 dir_list = evas_list_append(dir_list, new_epd); 395 new_epd = malloc(sizeof(E_Path_Dir));
396 new_epd->dir = strdup(epd->dir);
397 dir_list = evas_list_append(dir_list, new_epd);
398 }
361 } 399 }
362 400
363 return dir_list; 401 return dir_list;