summary refs log tree commit diff stats
path: root/src/fe-gtk/plugingui.c
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-07-26 20:53:59 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-07-26 20:53:59 +0200
commitec301a5a5486898cb4d9854a56eb866f1b93f634 (patch)
treec0cec2f567df7e1f62fc0168b2fe3cc68c9d8954 /src/fe-gtk/plugingui.c
parent7f831646bb8c31966e0f3ff77d40ce66711daa99 (diff)
Auto-load user plugins and scripts from <config>/addons
On Unix leave $(libdir)/hexchat/plugins for plugin packagers, on Windows
prevent users from modifying Program Files by ignoring everything except
bundled plugins
Diffstat (limited to 'src/fe-gtk/plugingui.c')
-rw-r--r--src/fe-gtk/plugingui.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c
index d17aadb7..00566533 100644
--- a/src/fe-gtk/plugingui.c
+++ b/src/fe-gtk/plugingui.c
@@ -147,6 +147,15 @@ plugingui_load_cb (session *sess, char *file)
 void
 plugingui_load (void)
 {
+	/* let's do it the Perl way */
+	const char *xdir;
+	char *sub_dir;
+
+	xdir = get_xdir_utf8 ();
+	sub_dir = malloc (strlen (xdir) + 8);
+	strcpy (sub_dir, xdir);
+	strcat (sub_dir, "/addons");
+
 	gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
 #if 0	/* native file dialogs */
 #ifdef WIN32
@@ -156,10 +165,12 @@ plugingui_load (void)
 #endif
 #endif	/* native file dialogs */
 #ifdef WIN32
-							get_xdir_utf8 (), "*.dll;*.lua;*.pl;*.py;*.tcl", FRF_ADDFOLDER|FRF_FILTERISINITIAL|FRF_EXTENSIONS);
+							sub_dir, "*.dll;*.lua;*.pl;*.py;*.tcl", FRF_ADDFOLDER|FRF_FILTERISINITIAL|FRF_EXTENSIONS);
 #else
-							get_xdir_utf8 (), "*.so;*.lua;*.pl;*.py;*.tcl", FRF_ADDFOLDER|FRF_FILTERISINITIAL|FRF_EXTENSIONS);
+							sub_dir, "*.so;*.lua;*.pl;*.py;*.tcl", FRF_ADDFOLDER|FRF_FILTERISINITIAL|FRF_EXTENSIONS);
 #endif
+
+	free (sub_dir);
 }
 
 static void