summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-07-26 16:19:45 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-07-26 16:19:45 +0200
commit7f831646bb8c31966e0f3ff77d40ce66711daa99 (patch)
tree27976e8ad12e2bd672eae904042fbe2db4c6b4b2
parent309f1d356261fc7df70f320e070a758886ccdd44 (diff)
Autoload local plugins from <config>/plugins
-rw-r--r--src/common/plugin.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c
index d8211e82..1bec7a7a 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -458,18 +458,30 @@ void
 plugin_auto_load (session *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
 	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
 #if defined(__hpux)
 	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
 	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
+
+	free (sub_dir);
 }
 
 #endif