summaryrefslogtreecommitdiff
path: root/src/plugins/plugins.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-10-17 11:53:46 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-10-17 11:53:46 +0000
commitb2ec60110c17716c9b7ad2e07ece6734db1c82e8 (patch)
tree5ecded3ec38562b47c9b2b74fb0971475784a86f /src/plugins/plugins.c
parent9eb142036eb13d84fc06e304157b78b75ee3e24a (diff)
downloadweechat-b2ec60110c17716c9b7ad2e07ece6734db1c82e8.zip
Auto-load plugins in user's plugins path (before WeeChat system lib dir)
Diffstat (limited to 'src/plugins/plugins.c')
-rw-r--r--src/plugins/plugins.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c
index 3b5eb884e..cfba9067d 100644
--- a/src/plugins/plugins.c
+++ b/src/plugins/plugins.c
@@ -747,8 +747,28 @@ int plugin_auto_load_file (t_weechat_plugin *plugin, char *filename)
void plugin_auto_load ()
{
- char *dir_name;
+ char *ptr_home, *dir_name;
+
+ /* auto-load plugins in WeeChat home dir */
+ if (cfg_plugins_path && cfg_plugins_path[0])
+ {
+ if (cfg_plugins_path[0] == '~')
+ {
+ ptr_home = getenv ("HOME");
+ dir_name = (char *)malloc (strlen (cfg_plugins_path) + strlen (ptr_home) + 2);
+ if (dir_name)
+ {
+ strcpy (dir_name, ptr_home);
+ strcat (dir_name, cfg_plugins_path + 1);
+ plugin_exec_on_files (NULL, dir_name, &plugin_auto_load_file);
+ free (dir_name);
+ }
+ }
+ else
+ plugin_exec_on_files (NULL, cfg_plugins_path, &plugin_auto_load_file);
+ }
+ /* auto-load plugins in WeeChat global lib dir */
dir_name = (char *)malloc (strlen (WEECHAT_LIBDIR) + 16);
if (dir_name)
{