From 0ab89ca2f875ad31dde266da63cef24ecb272255 Mon Sep 17 00:00:00 2001 From: Crispin Flowerday Date: Sat, 24 Sep 2005 16:11:01 +0000 Subject: If the library path isn't absolute, look in the main extension dir, and 2005-09-24 Crispin Flowerday * lib/Makefile.am: * lib/ephy-module.c: (ephy_module_load): If the library path isn't absolute, look in the main extension dir, and then the users own extension directory --- lib/Makefile.am | 1 + lib/ephy-module.c | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Makefile.am b/lib/Makefile.am index a0473e870..cec961f04 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -73,6 +73,7 @@ libephymisc_la_SOURCES = \ libephymisc_la_CPPFLAGS = \ -I$(top_builddir)/lib \ -DSHARE_DIR=\"$(pkgdatadir)\" \ + -DEXTENSIONS_DIR=\""$(libdir)/epiphany/$(EPIPHANY_MAJOR)/extensions"\" \ $(AM_CPPFLAGS) libephymisc_la_CFLAGS = \ diff --git a/lib/ephy-module.c b/lib/ephy-module.c index 4c6731461..9572d2010 100644 --- a/lib/ephy-module.c +++ b/lib/ephy-module.c @@ -84,10 +84,34 @@ ephy_module_load (GTypeModule *gmodule) { EphyModule *module = EPHY_MODULE (gmodule); EphyModuleRegisterFunc register_func; + gboolean is_absolute; LOG ("Loading %s", module->path); - module->library = g_module_open (module->path, 0); + is_absolute = g_path_is_absolute (module->path); + + if (module->library == NULL && ! is_absolute) + { + char *path = g_build_filename (EXTENSIONS_DIR, module->path, NULL); + + module->library = g_module_open (path, 0); + + g_free (path); + } + + if (module->library == NULL && ! is_absolute) + { + char *path = g_build_filename (ephy_dot_dir(), "extensions", module->path, NULL); + + module->library = g_module_open (path, 0); + + g_free (path); + } + + if (module->library == NULL) + { + module->library = g_module_open (module->path, 0); + } if (module->library == NULL) { -- cgit v1.2.3