diff options
Diffstat (limited to 'src/common/plugin.c')
-rw-r--r-- | src/common/plugin.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c index c14db021..08198cb6 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -367,12 +367,30 @@ char * plugin_load (session *sess, char *filename, char *arg) { void *handle; + char *pluginpath; + char *error; + char *filepart; hexchat_init_func *init_func; hexchat_deinit_func *deinit_func; + /* get the filename without path */ + filepart = file_part (filename); + #ifdef USE_GMODULE /* load the plugin */ - handle = g_module_open (filename, 0); + if (!g_ascii_strcasecmp (filepart, filename)) + { + /* no path specified, it's just the filename, try to load from config dir */ + pluginpath = g_build_filename (get_xdir (), filename, NULL); + handle = g_module_open (pluginpath, 0); + g_free (pluginpath); + } + else + { + /* try to load with absolute path */ + handle = g_module_open (filename, 0); + } + if (handle == NULL) return (char *)g_module_error (); @@ -388,8 +406,6 @@ plugin_load (session *sess, char *filename, char *arg) deinit_func = NULL; #else - char *error; - char *filepart; /* OpenBSD lacks this! */ #ifndef RTLD_GLOBAL @@ -400,9 +416,6 @@ plugin_load (session *sess, char *filename, char *arg) #define RTLD_NOW 0 #endif - /* get the filename without path */ - filepart = file_part (filename); - /* load the plugin */ if (filepart && /* xsys draws in libgtk-1.2, causing crashes, so force RTLD_LOCAL */ |