core: evaluate option weechat.plugin.path (issue #1285)
This commit is contained in:
parent
e5d18e1221
commit
f923524a21
@ -982,7 +982,7 @@ completion_list_add_plugins_installed_cb (const void *pointer, void *data,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_gui_completion *completion)
|
||||
{
|
||||
char *plugin_path, *plugin_path2, *dir_name, *extra_libdir;
|
||||
char *plugin_path, *dir_name, *extra_libdir;
|
||||
int length;
|
||||
|
||||
/* make C compiler happy */
|
||||
@ -1011,23 +1011,15 @@ completion_list_add_plugins_installed_cb (const void *pointer, void *data,
|
||||
if (CONFIG_STRING(config_plugin_path)
|
||||
&& CONFIG_STRING(config_plugin_path)[0])
|
||||
{
|
||||
plugin_path = string_expand_home (CONFIG_STRING(config_plugin_path));
|
||||
plugin_path2 = string_replace (
|
||||
(plugin_path) ?
|
||||
plugin_path : CONFIG_STRING(config_plugin_path),
|
||||
"%h", weechat_home);
|
||||
util_exec_on_files (
|
||||
(plugin_path2) ?
|
||||
plugin_path2 : ((plugin_path) ?
|
||||
plugin_path : CONFIG_STRING(config_plugin_path)),
|
||||
1,
|
||||
0,
|
||||
&completion_list_add_plugins_installed_exec_cb,
|
||||
completion);
|
||||
plugin_path = string_eval_path_home (CONFIG_STRING(config_plugin_path),
|
||||
NULL, NULL, NULL);
|
||||
if (plugin_path)
|
||||
{
|
||||
util_exec_on_files (plugin_path, 1, 0,
|
||||
&completion_list_add_plugins_installed_exec_cb,
|
||||
completion);
|
||||
free (plugin_path);
|
||||
if (plugin_path2)
|
||||
free (plugin_path2);
|
||||
}
|
||||
}
|
||||
|
||||
/* plugins in WeeChat global lib dir */
|
||||
|
@ -4564,8 +4564,9 @@ config_weechat_init_options ()
|
||||
config_plugin_path = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"path", "string",
|
||||
N_("path for searching plugins (\"%h\" will be replaced by "
|
||||
"WeeChat home, \"~/.weechat\" by default)"),
|
||||
N_("path for searching plugins "
|
||||
"(path is evaluated, see function string_eval_path_home in "
|
||||
"plugin API reference)"),
|
||||
NULL, 0, 0, "%h/plugins", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_plugin_save_config_on_unload = config_file_new_option (
|
||||
|
@ -1011,7 +1011,7 @@ plugin_auto_load (char *force_plugin_autoload,
|
||||
int load_from_lib_dir,
|
||||
int argc, char **argv)
|
||||
{
|
||||
char *dir_name, *plugin_path, *plugin_path2, *extra_libdir;
|
||||
char *dir_name, *plugin_path, *extra_libdir;
|
||||
const char *ptr_plugin_autoload;
|
||||
struct t_weechat_plugin *ptr_plugin;
|
||||
struct t_plugin_args plugin_args;
|
||||
@ -1045,20 +1045,14 @@ plugin_auto_load (char *force_plugin_autoload,
|
||||
&& CONFIG_STRING(config_plugin_path)
|
||||
&& CONFIG_STRING(config_plugin_path)[0])
|
||||
{
|
||||
plugin_path = string_expand_home (CONFIG_STRING(config_plugin_path));
|
||||
plugin_path2 = string_replace ((plugin_path) ?
|
||||
plugin_path : CONFIG_STRING(config_plugin_path),
|
||||
"%h", weechat_home);
|
||||
util_exec_on_files ((plugin_path2) ?
|
||||
plugin_path2 : ((plugin_path) ?
|
||||
plugin_path : CONFIG_STRING(config_plugin_path)),
|
||||
1,
|
||||
0,
|
||||
&plugin_auto_load_file, &plugin_args);
|
||||
plugin_path = string_eval_path_home (CONFIG_STRING(config_plugin_path),
|
||||
NULL, NULL, NULL);
|
||||
if (plugin_path)
|
||||
{
|
||||
util_exec_on_files (plugin_path, 1, 0,
|
||||
&plugin_auto_load_file, &plugin_args);
|
||||
free (plugin_path);
|
||||
if (plugin_path2)
|
||||
free (plugin_path2);
|
||||
}
|
||||
}
|
||||
|
||||
/* auto-load plugins in WEECHAT_EXTRA_LIBDIR environment variable */
|
||||
|
Loading…
x
Reference in New Issue
Block a user