diff options
-rw-r--r-- | src/command/cmd_defs.c | 2 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 36 |
2 files changed, 37 insertions, 1 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 898608af..37a2db89 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2155,7 +2155,7 @@ static struct cmd_t command_defs[] = { "/plugins reload [<plugin>]", "/plugins python_version") CMD_DESC( - "Manage plugins. Passing no arguments lists currently loaded plugins.") + "Manage plugins. Passing no arguments lists currently loaded plugins and global plugins which are available for local installation. Global directory for Python plugins is " GLOBAL_PYTHON_PLUGINS_PATH " and for C Plugins is " GLOBAL_C_PLUGINS_PATH ".") CMD_ARGS( { "install [<path>]", "Install a plugin, or all plugins found in a directory (recursive)." }, { "uninstall [<plugin>]", "Uninstall a plugin." }, diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 302de659..ab48c3fb 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -7172,6 +7172,42 @@ cmd_plugins_python_version(ProfWin* window, const char* const command, gchar** a gboolean cmd_plugins(ProfWin* window, const char* const command, gchar** args) { + GDir* global_pyp_dir = NULL; + GDir* global_cp_dir = NULL; + + if (access(GLOBAL_PYTHON_PLUGINS_PATH, R_OK) == 0) { + GError* error = NULL; + global_pyp_dir = g_dir_open(GLOBAL_PYTHON_PLUGINS_PATH, 0, &error); + if (error) { + log_warning("Error when trying to open global plugins path: %s", GLOBAL_PYTHON_PLUGINS_PATH); + g_error_free(error); + return TRUE; + } + } + if (access(GLOBAL_C_PLUGINS_PATH, R_OK) == 0) { + GError* error = NULL; + global_cp_dir = g_dir_open(GLOBAL_C_PLUGINS_PATH, 0, &error); + if (error) { + log_warning("Error when trying to open global plugins path: %s", GLOBAL_C_PLUGINS_PATH); + g_error_free(error); + return TRUE; + } + } + if (global_pyp_dir) { + const gchar *filename; + cons_show("The following Python plugins are available globally and can be installed:"); + while ((filename = g_dir_read_name(global_pyp_dir))) { + cons_show(" %s", filename); + } + } + if (global_cp_dir) { + const gchar *filename; + cons_show("The following C plugins are available globally and can be installed:"); + while ((filename = g_dir_read_name(global_cp_dir))) { + cons_show(" %s", filename); + } + } + GList* plugins = plugins_loaded_list(); if (plugins == NULL) { cons_show("No plugins installed."); |