commit fef080f9326aaf109858e62a9783087378e0046b
parent 98d859a0e4ac457b8f06763bf1cc7a2800891440
Author: Colin Leroy <colin@colino.net>
Date: Wed, 14 Nov 2012 10:16:12 +0000
2012-11-14 [colin] 3.8.1cvs119
* src/common/plugin.c
If plugin fails to load from absolute path, try from
default plugin path.
Fixes bug #1137, 'loading plugins with same profile on different archs'
Fixes bug #2777, 'Installing latest cvs116 package 14 Windows version
results in wrong paths in clawsrc'
Diffstat:
4 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,12 @@
+2012-11-14 [colin] 3.8.1cvs119
+
+ * src/common/plugin.c
+ If plugin fails to load from absolute path, try from
+ default plugin path.
+ Fixes bug #1137, 'loading plugins with same profile on different archs'
+ Fixes bug #2777, 'Installing latest cvs116 package 14 Windows version
+ results in wrong paths in clawsrc'
+
2012-11-12 [colin] 3.8.1cvs118
* src/messageview.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -4493,3 +4493,4 @@
( cvs diff -u -r 1.13.2.50 -r 1.13.2.51 src/common/socket.c; cvs diff -u -r 1.5.2.104 -r 1.5.2.105 src/gtk/gtkutils.c; ) > 3.8.1cvs116.patchset
( cvs diff -u -r 1.1.4.123 -r 1.1.4.124 src/etpan/imap-thread.c; ) > 3.8.1cvs117.patchset
( cvs diff -u -r 1.94.2.240 -r 1.94.2.241 src/messageview.c; ) > 3.8.1cvs118.patchset
+( cvs diff -u -r 1.13.2.46 -r 1.13.2.47 src/common/plugin.c; ) > 3.8.1cvs119.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=8
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=118
+EXTRA_VERSION=119
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/common/plugin.c b/src/common/plugin.c
@@ -351,6 +351,38 @@ static gboolean plugin_licence_check(const gchar *licence) {
return FALSE;
}
+static gboolean plugin_filename_is_standard_dir(const gchar *filename) {
+ return strncmp(filename, get_plugin_dir(), strlen(get_plugin_dir())) == 0;
+}
+
+static Plugin *plugin_load_in_default_dir(const gchar *filename, gchar **error)
+{
+ Plugin *plugin = NULL;
+ gchar *filename_default_dir = NULL;
+ gchar *default_error = NULL;
+ gchar *plugin_name = g_path_get_basename(filename);
+
+ filename_default_dir = g_strconcat(get_plugin_dir(), plugin_name, NULL);
+
+ debug_print("trying to load %s in default plugin directory %s\n",
+ plugin_name, get_plugin_dir());
+
+ g_free(plugin_name);
+
+ plugin = plugin_load(filename_default_dir, &default_error);
+
+ g_free(filename_default_dir);
+
+ if (plugin) {
+ g_free(*error);
+ *error = NULL;
+ } else {
+ g_free(default_error);
+ }
+
+ return plugin;
+}
+
/**
* Loads a plugin
*
@@ -398,7 +430,10 @@ Plugin *plugin_load(const gchar *filename, gchar **error)
if (plugin->module == NULL) {
*error = g_strdup(g_module_error());
g_free(plugin);
- return NULL;
+ if (!plugin_filename_is_standard_dir(filename))
+ return plugin_load_in_default_dir(filename, error);
+ else
+ return NULL;
}
init_plugin: