diff options
author | Richard Hughes <richard@hughsie.com> | 2015-01-22 21:27:52 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-01-22 21:59:01 +0000 |
commit | 8b0ec4d422e84876923c3473ea680587c8a7ebec (patch) | |
tree | 8e40d89a71aaa10e9cef0a9215fcaf49eda25319 /libappstream-builder/asb-plugin.c | |
parent | 775f59405fd9f5269ff7d4e3d0a78133f7af5de2 (diff) | |
download | appstream-glib-8b0ec4d422e84876923c3473ea680587c8a7ebec.tar.gz |
trivial: Add asb_plugin_match_glob()
This allows us to modify the prefix in the future for bundles.
Diffstat (limited to 'libappstream-builder/asb-plugin.c')
-rw-r--r-- | libappstream-builder/asb-plugin.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libappstream-builder/asb-plugin.c b/libappstream-builder/asb-plugin.c index 26903d0..293653b 100644 --- a/libappstream-builder/asb-plugin.c +++ b/libappstream-builder/asb-plugin.c @@ -30,6 +30,7 @@ #include "config.h" #include <glib.h> +#include <fnmatch.h> #include "asb-plugin.h" #include "asb-utils.h" @@ -118,3 +119,18 @@ asb_plugin_add_glob (GPtrArray *array, const gchar *glob) { g_ptr_array_add (array, asb_glob_value_new (glob, "")); } + +/** + * asb_plugin_match_glob: + * @glob: a filename glob + * @value: a filename value + * + * Matches a value against a glob. + * + * Since: 0.3.5 + **/ +gboolean +asb_plugin_match_glob (const gchar *glob, const gchar *value) +{ + return (fnmatch (glob, value, 0) == 0); +} |