1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-23 01:32:22 -05:00

If no path given, try to load plugins from config dir, not from install dir

This commit is contained in:
Berke Viktor 2013-04-14 12:55:02 +02:00
parent 9dd2c85df4
commit 069a6adb19

View File

@ -367,12 +367,30 @@ char *
plugin_load (session *sess, char *filename, char *arg) plugin_load (session *sess, char *filename, char *arg)
{ {
void *handle; void *handle;
char *pluginpath;
char *error;
char *filepart;
hexchat_init_func *init_func; hexchat_init_func *init_func;
hexchat_deinit_func *deinit_func; hexchat_deinit_func *deinit_func;
/* get the filename without path */
filepart = file_part (filename);
#ifdef USE_GMODULE #ifdef USE_GMODULE
/* load the plugin */ /* 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) if (handle == NULL)
return (char *)g_module_error (); return (char *)g_module_error ();
@ -388,8 +406,6 @@ plugin_load (session *sess, char *filename, char *arg)
deinit_func = NULL; deinit_func = NULL;
#else #else
char *error;
char *filepart;
/* OpenBSD lacks this! */ /* OpenBSD lacks this! */
#ifndef RTLD_GLOBAL #ifndef RTLD_GLOBAL
@ -400,9 +416,6 @@ plugin_load (session *sess, char *filename, char *arg)
#define RTLD_NOW 0 #define RTLD_NOW 0
#endif #endif
/* get the filename without path */
filepart = file_part (filename);
/* load the plugin */ /* load the plugin */
if (filepart && if (filepart &&
/* xsys draws in libgtk-1.2, causing crashes, so force RTLD_LOCAL */ /* xsys draws in libgtk-1.2, causing crashes, so force RTLD_LOCAL */