Autoload local plugins from <config>/plugins

This commit is contained in:
Berke Viktor 2012-07-26 16:19:45 +02:00
parent 309f1d3562
commit 7f831646bb
1 changed files with 15 additions and 3 deletions

View File

@ -458,18 +458,30 @@ void
plugin_auto_load (session *sess) plugin_auto_load (session *sess)
{ {
ps = sess; ps = sess;
/* let's do it the Perl way */
const char *xdir;
char *sub_dir;
xdir = get_xdir_fs ();
sub_dir = malloc (strlen (xdir) + 9);
strcpy (sub_dir, xdir);
strcat (sub_dir, "/plugins");
#ifdef WIN32 #ifdef WIN32
for_files ("./plugins", "*.dll", plugin_auto_load_cb); for_files ("./plugins", "*.dll", plugin_auto_load_cb);
for_files (get_xdir_fs (), "*.dll", plugin_auto_load_cb); for_files (sub_dir, "*.dll", plugin_auto_load_cb);
#else #else
#if defined(__hpux) #if defined(__hpux)
for_files (HEXCHATLIBDIR"/plugins", "*.sl", plugin_auto_load_cb); for_files (HEXCHATLIBDIR"/plugins", "*.sl", plugin_auto_load_cb);
for_files (get_xdir_fs (), "*.sl", plugin_auto_load_cb); for_files (sub_dir, "*.sl", plugin_auto_load_cb);
#else #else
for_files (HEXCHATLIBDIR"/plugins", "*.so", plugin_auto_load_cb); for_files (HEXCHATLIBDIR"/plugins", "*.so", plugin_auto_load_cb);
for_files (get_xdir_fs (), "*.so", plugin_auto_load_cb); for_files (sub_dir, "*.so", plugin_auto_load_cb);
#endif #endif
#endif #endif
free (sub_dir);
} }
#endif #endif