From c04f1e77d6736dcb86aea876ce8efa5636dc2fac Mon Sep 17 00:00:00 2001 From: Christian Thaeter Date: Thu, 6 Nov 2008 04:13:13 +0100 Subject: [PATCH] set LUMIERA_PLUGIN_PATH to $pkglibdir as default --- src/backend/Makefile.am | 3 ++- src/backend/plugin.c | 15 +++++++++------ tests/31plugin.tests | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am index d8c0c159e..f37f51a57 100644 --- a/src/backend/Makefile.am +++ b/src/backend/Makefile.am @@ -18,7 +18,8 @@ liblumibackend_a_srcdir = $(top_srcdir)/src/backend noinst_LIBRARIES += liblumibackend.a -liblumibackend_a_CFLAGS = $(CFLAGS) -std=gnu99 -Wextra -Wall -Werror +liblumibackend_a_CPPFLAGS = $(AM_CPPFLAGS) -DLUMIERA_PLUGIN_PATH="\"$(pkglibdir)\"" +liblumibackend_a_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror liblumibackend_a_SOURCES = \ $(liblumibackend_a_srcdir)/mediaaccessfacade.cpp \ diff --git a/src/backend/plugin.c b/src/backend/plugin.c index 0bba34409..ea189b57e 100644 --- a/src/backend/plugin.c +++ b/src/backend/plugin.c @@ -33,6 +33,10 @@ #include +#ifndef LUMIERA_PLUGIN_PATH +#error TODO: hey ichthyo, please figure the $pkglib path out by scons and use it as -DLUMIERA_PLUGIN_PATH for this source +#endif + /** * @file * Plugin loader. @@ -193,6 +197,8 @@ lumiera_plugin_discover (LumieraPlugin (*callback_load)(const char* plugin), REQUIRE (callback_load); REQUIRE (callback_register); + lumiera_config_setdefault ("plugin.path ="LUMIERA_PLUGIN_PATH); + /* construct glob trail {.so,.c,.foo} ... */ static char* exts_globs = NULL; if (!exts_globs) @@ -205,7 +211,7 @@ lumiera_plugin_discover (LumieraPlugin (*callback_load)(const char* plugin), while ((path = lumiera_config_wordlist_get_nth ("plugin.path", i, ":"))) { - path = lumiera_tmpbuf_snprintf (SIZE_MAX,"%s%s", path, exts_globs); + path = lumiera_tmpbuf_snprintf (SIZE_MAX,"%s/%s", path, exts_globs); TRACE (plugin, "globbing path '%s'", path); int ret = glob (path, flags, NULL, &globs); if (ret == GLOB_NOSPACE) @@ -215,9 +221,6 @@ lumiera_plugin_discover (LumieraPlugin (*callback_load)(const char* plugin), ++i; } - if (lumiera_error_peek ()) - return 0; - if (globs.gl_pathc) LUMIERA_RECMUTEX_SECTION (plugin, &lumiera_interface_mutex) { @@ -350,7 +353,7 @@ lumiera_plugin_lookup (const char* name) static char* init_exts_globs () { char* exts_globs; - size_t exts_sz = 4; /* / * { } \0 less one comma */ + size_t exts_sz = 3; /* * { } \0 less one comma */ LumieraPlugintype itr = lumiera_plugin_types; while (itr->ext) { @@ -362,7 +365,7 @@ static char* init_exts_globs () *exts_globs = '\0'; itr = lumiera_plugin_types; - strcat (exts_globs, "/*{"); + strcat (exts_globs, "*{"); while (itr->ext) { diff --git a/tests/31plugin.tests b/tests/31plugin.tests index d2107dd3c..776f79da6 100644 --- a/tests/31plugin.tests +++ b/tests/31plugin.tests @@ -2,7 +2,7 @@ TESTING "testing plugins" ./test-interfaces TEST "discovering plugins, missing path" plugin_discover <