diff options
author | Berke Viktor <bviktor@hexchat.org> | 2012-07-26 20:53:59 +0200 |
---|---|---|
committer | Berke Viktor <bviktor@hexchat.org> | 2012-07-26 20:53:59 +0200 |
commit | ec301a5a5486898cb4d9854a56eb866f1b93f634 (patch) | |
tree | c0cec2f567df7e1f62fc0168b2fe3cc68c9d8954 /plugins | |
parent | 7f831646bb8c31966e0f3ff77d40ce66711daa99 (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 'plugins')
-rw-r--r-- | plugins/lua/lua.c | 4 | ||||
-rw-r--r-- | plugins/perl/perl.c | 6 | ||||
-rw-r--r-- | plugins/python/python.c | 12 | ||||
-rw-r--r-- | plugins/tcl/tclplugin.c | 6 |
4 files changed, 14 insertions, 14 deletions
diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index a70ad0d6..8fc55a26 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -525,7 +525,7 @@ static int lxc_cb_load(char *word[], char *word_eol[], void *userdata) else { xdir = xchat_get_info (ph, "xchatdirfs"); - snprintf (file, PATH_MAX, "%s/scripts/%s", xdir, word[2]); + snprintf (file, PATH_MAX, "%s/addons/%s", xdir, word[2]); } } @@ -679,7 +679,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, xchat_hook_command(ph, "LUA", XCHAT_PRI_NORM, lxc_cb_lua, "Usage: LUA <code>, executes <code> in a new lua state", NULL); xdir = xchat_get_info (ph, "xchatdirfs"); - xsubdir = g_build_filename (xdir, "scripts", NULL); + xsubdir = g_build_filename (xdir, "addons", NULL); lxc_autoload_from_path (xsubdir); g_free (xsubdir); diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index 7eea9efb..c9bfa5e9 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -145,15 +145,15 @@ perl_auto_load (void *unused) xdir = xchat_get_info (ph, "xchatdir"); /* don't pollute the filesystem with script files, this only causes misuse of the folders - * only use ~/.config/hexchat/scripts/ and %APPDATA%\HexChat\scripts */ + * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ #if 0 /* autoload from ~/.config/hexchat/ or %APPDATA%\HexChat\ on win32 */ perl_auto_load_from_path (xdir); #endif - sub_dir = malloc (strlen (xdir) + 9); + sub_dir = malloc (strlen (xdir) + 8); strcpy (sub_dir, xdir); - strcat (sub_dir, "/scripts"); + strcat (sub_dir, "/addons"); perl_auto_load_from_path (sub_dir); free (sub_dir); diff --git a/plugins/python/python.c b/plugins/python/python.c index 477cbc74..38b98c4a 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -392,16 +392,16 @@ Util_Autoload() xdir = xchat_get_info(ph, "xchatdirfs"); /* don't pollute the filesystem with script files, this only causes misuse of the folders - * only use ~/.config/hexchat/scripts/ and %APPDATA%\HexChat\scripts */ + * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ #if 0 /* auto-load from ~/.config/hexchat/ or %APPDATA%\HexChat\ */ Util_Autoload_from(xchat_get_info(ph, "xchatdirfs")); #endif - /* auto-load from subdirectory scripts */ - sub_dir = malloc (strlen (xdir) + 9); + /* auto-load from subdirectory addons */ + sub_dir = malloc (strlen (xdir) + 8); strcpy (sub_dir, xdir); - strcat (sub_dir, "/scripts"); + strcat (sub_dir, "/addons"); Util_Autoload_from(sub_dir); free (sub_dir); @@ -444,9 +444,9 @@ Util_Expand(char *filename) return expanded; g_free(expanded); - /* Check if ~/.config/hexchat/scripts/<filename> exists. */ + /* Check if ~/.config/hexchat/addons/<filename> exists. */ expanded = g_build_filename(xchat_get_info(ph, "xchatdir"), - "scripts", filename, NULL); + "addons", filename, NULL); if (g_file_test(expanded, G_FILE_TEST_EXISTS)) return expanded; g_free(expanded); diff --git a/plugins/tcl/tclplugin.c b/plugins/tcl/tclplugin.c index 168e0f54..1c434d40 100644 --- a/plugins/tcl/tclplugin.c +++ b/plugins/tcl/tclplugin.c @@ -90,9 +90,9 @@ static char unknown[] = { }; /* don't pollute the filesystem with script files, this only causes misuse of the folders - * only use ~/.config/hexchat/scripts/ and %APPDATA%\HexChat\scripts */ + * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ static char sourcedirs[] = { - "set files [lsort [glob -nocomplain -directory [xchatdir] \"/scripts/*.tcl\"]]\n" + "set files [lsort [glob -nocomplain -directory [xchatdir] \"/addons/*.tcl\"]]\n" "set init [lsearch -glob $files \"*/init.tcl\"]\n" "if { $init > 0 } {\n" "set initfile [lindex $files $init]\n" @@ -2039,7 +2039,7 @@ static int Command_Source(char *word[], char *word_eol[], void *userdata) } else { if (!strchr(word_eol[2], '/')) { Tcl_DStringAppend(&ds, xchatdir, strlen(xchatdir)); - Tcl_DStringAppend(&ds, "/scripts/", 9); + Tcl_DStringAppend(&ds, "/addons/", 8); Tcl_DStringAppend(&ds, word_eol[2], strlen(word_eol[2])); } } |