Revision: 5825 http://geany.svn.sourceforge.net/geany/?rev=5825&view=rev Author: eht16 Date: 2011-05-29 20:08:53 +0000 (Sun, 29 May 2011)
Log Message: ----------- Check whether the custom plugin path is one of the user or system plugin paths and if so, ignore it.
Modified Paths: -------------- trunk/ChangeLog trunk/src/plugins.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-05-29 19:45:16 UTC (rev 5824) +++ trunk/ChangeLog 2011-05-29 20:08:53 UTC (rev 5825) @@ -8,6 +8,8 @@ code into the function definition. Do not add active plugins to the list of plugins when they are already in the list (closes #3308191). + Check whether the custom plugin path is one of the user or system + plugin paths and if so, ignore it.
2011-05-27 Colomban Wendling <colomban(at)geany(dot)org>
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2011-05-29 19:45:16 UTC (rev 5824) +++ trunk/src/plugins.c 2011-05-29 20:08:53 UTC (rev 5825) @@ -895,8 +895,8 @@ static gchar *get_plugin_path() { #ifdef G_OS_WIN32 + gchar *path; gchar *install_dir = win32_get_installation_dir(); - gchar *path;
path = g_strconcat(install_dir, "\lib", NULL); g_free(install_dir); @@ -908,24 +908,49 @@ }
+static gboolean validate_custom_plugin_path(const gchar *plugin_path_custom, + const gchar *plugin_path_config, + const gchar *plugin_path_system) +{ + /* check whether the custom plugin path is one of the system or user plugin paths + * and abort if so */ + if (utils_str_equal(plugin_path_custom, plugin_path_config) || + utils_str_equal(plugin_path_custom, plugin_path_system)) + return FALSE; + + return TRUE; +} + + /* Load (but don't initialize) all plugins for the Plugin Manager dialog */ static void load_all_plugins(void) { - gchar *path; + gchar *plugin_path_config; + gchar *plugin_path_system;
- path = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", NULL); + plugin_path_config = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", NULL); + plugin_path_system = get_plugin_path(); + /* first load plugins in ~/.config/geany/plugins/ */ - load_plugins_from_path(path); - g_free(path); + load_plugins_from_path(plugin_path_config);
/* load plugins from a custom path */ if (NZV(prefs.custom_plugin_path)) - load_plugins_from_path(prefs.custom_plugin_path); + { + gchar *plugin_path_custom = utils_get_locale_from_utf8(prefs.custom_plugin_path); + utils_tidy_path(plugin_path_custom);
+ if (validate_custom_plugin_path(plugin_path_custom, plugin_path_config, plugin_path_system)) + load_plugins_from_path(plugin_path_custom); + + g_free(plugin_path_custom); + } + /* finally load plugins from $prefix/lib/geany */ - path = get_plugin_path(); - load_plugins_from_path(path); - g_free(path); + load_plugins_from_path(plugin_path_system); + + g_free(plugin_path_config); + g_free(plugin_path_system); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.