diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua.c | 2 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl.c | 2 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 2 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby.c | 2 | ||||
-rw-r--r-- | src/plugins/scripts/weechat-script.c | 35 |
5 files changed, 28 insertions, 15 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index a727d3618..1db5ccc1e 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -2487,7 +2487,7 @@ weechat_plugin_init (t_weechat_plugin *plugin) "filename: Lua script (file) to load\n" "script: script name to unload\n\n" "Without argument, /lua command lists all loaded Lua scripts.", - "load|autoload|reload|unload", + "load|autoload|reload|unload %f", weechat_lua_cmd, NULL, NULL); plugin->mkdir_home (plugin, "lua"); diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 8b97977b5..2566e373c 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -2238,7 +2238,7 @@ weechat_plugin_init (t_weechat_plugin *plugin) "filename: Perl script (file) to load\n" "script: script name to unload\n\n" "Without argument, /perl command lists all loaded Perl scripts.", - "load|autoload|reload|unload", + "load|autoload|reload|unload %f", weechat_perl_cmd, NULL, NULL); plugin->mkdir_home (plugin, "perl"); diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 72af29bb1..bf55a5262 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -2235,7 +2235,7 @@ weechat_plugin_init (t_weechat_plugin *plugin) "filename: Python script (file) to load\n" "script: script name to unload\n\n" "Without argument, /python command lists all loaded Python scripts.", - "load|autoload|reload|unload", + "load|autoload|reload|unload %f", weechat_python_cmd, NULL, NULL); plugin->mkdir_home (plugin, "python"); diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index e46e80bfc..d6f4dcd45 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -2464,7 +2464,7 @@ weechat_plugin_init (t_weechat_plugin *plugin) "filename: Ruby script (file) to load\n" "script: script name to unload\n\n" "Without argument, /ruby command lists all loaded Ruby scripts.", - "load|autoload|reload|unload", + "load|autoload|reload|unload %f", weechat_ruby_cmd, NULL, NULL); plugin->mkdir_home (plugin, "ruby"); diff --git a/src/plugins/scripts/weechat-script.c b/src/plugins/scripts/weechat-script.c index 799138141..28a35048f 100644 --- a/src/plugins/scripts/weechat-script.c +++ b/src/plugins/scripts/weechat-script.c @@ -110,14 +110,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin, } return NULL; } - -#ifdef _WIN32 - if (strstr(filename, "\\")) -#else - if (strstr(filename, "/")) -#endif - return strdup(filename); - + /* try WeeChat user's autoload dir */ dir_home = plugin->get_info (plugin, "weechat_dir", NULL); if (dir_home) @@ -137,7 +130,7 @@ weechat_script_search_full_name (t_weechat_plugin *plugin, free (dir_home); } - /* try WeeChat user's dir */ + /* try WeeChat language user's dir */ dir_home = plugin->get_info (plugin, "weechat_dir", NULL); if (dir_home) { @@ -156,6 +149,26 @@ weechat_script_search_full_name (t_weechat_plugin *plugin, free (dir_home); } + /* try WeeChat user's dir */ + dir_home = plugin->get_info (plugin, "weechat_dir", NULL); + if (dir_home) + { + length = strlen (dir_home) + strlen (filename) + 16; + final_name = (char *) malloc (length); + plugin->print_server (plugin, "final=[%s]\n", final_name); + if (final_name) + { + snprintf (final_name, length, "%s/%s", dir_home, filename); + if ((stat (final_name, &st) == 0) && (st.st_size > 0)) + { + free (dir_home); + return final_name; + } + free (final_name); + } + free (dir_home); + } + /* try WeeChat system dir */ dir_system = plugin->get_info (plugin, "weechat_sharedir", NULL); if (dir_system) @@ -174,8 +187,8 @@ weechat_script_search_full_name (t_weechat_plugin *plugin, } free (dir_system); } - - return NULL; + + return strdup(filename); } /* |