Enlightenment CVS committal
Author : tsauerbeck
Project : misc
Module : embrace
Dir : misc/embrace/src
Modified Files:
embrace.c embrace_plugin.c main.c
Log Message:
Don't use dl_foreachfile() to load the plugins
===================================================================
RCS file: /cvsroot/enlightenment/misc/embrace/src/embrace.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- embrace.c 22 Apr 2004 01:31:54 -0000 1.10
+++ embrace.c 22 Apr 2004 14:22:40 -0000 1.11
@@ -1,5 +1,5 @@
/*
- * $Id: embrace.c,v 1.10 2004/04/22 01:31:54 atmosphere Exp $
+ * $Id: embrace.c,v 1.11 2004/04/22 14:22:40 tsauerbeck Exp $
*
* Copyright (C) 2004 Embrace project.
*
@@ -128,30 +128,64 @@
return NULL;
}
-static int load_plugin (const char *file, lt_ptr udata)
+static void load_plugin (Embrace *e, const char *file)
{
- Embrace *e = udata;
EmbracePlugin *ep;
+ assert (e);
+ assert (file);
+
if (!(ep = embrace_plugin_new (file)))
- return 0;
+ return;
/* only add this plugin if it hasn't been added yet */
- if (find_plugin (e, ep->name)) {
+ if (find_plugin (e, ep->name))
embrace_plugin_free (ep);
- return 0;
- }
+ else
+ e->plugins = evas_list_append (e->plugins, ep);
+}
- e->plugins = evas_list_append (e->plugins, ep);
+static void load_plugins (Embrace *e, const char *path)
+{
+ DIR *dir;
+ struct dirent *entry;
+ char buf[PATH_MAX + 1];
+ int len;
- return 0;
+ assert (e);
+ assert (path);
+
+ if (!(dir = opendir (path)))
+ return;
+
+ while ((entry = readdir (dir))) {
+ if (!strcmp (entry->d_name, ".")
+ || !strcmp (entry->d_name, ".."))
+ continue;
+
+ if ((len = strlen (entry->d_name)) < 4)
+ continue;
+
+ if (!strcmp (&entry->d_name[len - 3], ".la")) {
+ snprintf (buf, sizeof (buf), "%s/%s", path, entry->d_name);
+ load_plugin (e, buf);
+ }
+ }
+
+ closedir (dir);
}
static bool embrace_load_plugins (Embrace *e)
{
+ char path[PATH_MAX + 1];
+
assert (e);
- lt_dlforeachfile (NULL, load_plugin, e);
+ snprintf (path, sizeof (path), "%s/.e/apps/" PACKAGE "/plugins",
+ getenv ("HOME"));
+
+ load_plugins (e, path);
+ load_plugins (e, PLUGIN_DIR);
return (evas_list_count (e->plugins) > 0);
}
===================================================================
RCS file: /cvsroot/enlightenment/misc/embrace/src/embrace_plugin.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- embrace_plugin.c 1 Mar 2004 20:02:58 -0000 1.1
+++ embrace_plugin.c 22 Apr 2004 14:22:40 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: embrace_plugin.c,v 1.1 2004/03/01 20:02:58 tsauerbeck Exp $
+ * $Id: embrace_plugin.c,v 1.2 2004/04/22 14:22:40 tsauerbeck Exp $
*
* Copyright (C) 2004 Embrace project.
*
@@ -36,7 +36,7 @@
if (!(ep = calloc (1, sizeof (EmbracePlugin))))
return NULL;
- if (!(ep->handle = lt_dlopenext (path))) {
+ if (!(ep->handle = lt_dlopen (path))) {
fprintf (stderr, "Cannot load plugin '%s': %s\n",
path, lt_dlerror ());
embrace_plugin_free (ep);
===================================================================
RCS file: /cvsroot/enlightenment/misc/embrace/src/main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- main.c 1 Apr 2004 18:29:36 -0000 1.3
+++ main.c 22 Apr 2004 14:22:40 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: main.c,v 1.3 2004/04/01 18:29:36 tsauerbeck Exp $
+ * $Id: main.c,v 1.4 2004/04/22 14:22:40 tsauerbeck Exp $
*
* Copyright (C) 2004 Embrace project.
*
@@ -38,8 +38,6 @@
static bool init ()
{
- char path[PATH_MAX * 2 + 2];
-
ecore_init ();
ecore_evas_init ();
edje_init ();
@@ -50,16 +48,6 @@
return false;
}
- /* set plugin search path */
- snprintf (path, sizeof (path), "%s/.e/apps/" PACKAGE "/plugins:"
- PLUGIN_DIR, getenv ("HOME"));
-
- if (lt_dlsetsearchpath (path)) {
- fprintf (stderr, "Cannot set LTDL search path to '%s'!\n",
- path);
- return false;
- }
-
return true;
}
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs