[Github-comments] [geany] Proxy plugins (#629)

Colomban Wendling notifications at xxxxx
Tue Sep 8 13:45:07 UTC 2015


> @@ -830,6 +1000,52 @@ static gboolean check_plugin_path(const gchar *fname)
>  }
>  
>  
> +/* Retuns NULL if this ain't a plugin,
> + * otherwise it returns the appropriate PluginProxy instance to load it */
> +static PluginProxy* is_plugin(const gchar *file)
> +{
> +	PluginProxy *proxy;
> +	const gchar *tmp;
> +	gint i;
> +
> +	/* extract file extension to avoid g_str_has_suffix() in the loop */
> +	tmp = (const gchar *)g_utf8_strrchr(file, -1, '.');
> +	if (tmp == NULL)
> +		return FALSE;
> +	/* ensure the dot is really part of the filename */
> +	else if (strchr(tmp, G_DIR_SEPARATOR) != NULL)

We don't deconstruct paths manually very often, and would generally use `g_path_get_basename()`.  But we do have [`utils_tidy_path()`](https://github.com/geany/geany/tree/master/src/utils.c#L1795) that does it.  I'm not certain we need it here, but I could easily imagine it could happen.

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/629/files#r38926442
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20150908/4d6b18ed/attachment.html>


More information about the Github-comments mailing list