summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-11-26 18:33:36 -0800
committerMichael Pavone <pavone@retrodev.com>2017-11-26 18:33:36 -0800
commitc9b253c58788376865cc8768ba342a67b4758bcf (patch)
tree39adf638ea96e87a36cc3b9972a3f9fded77eb3d /util.c
parent3c9268353c943b32ca517945c42dfb8c0b8484f8 (diff)
Filter file list in Nuklear UI
--HG-- branch : nuklear_ui
Diffstat (limited to 'util.c')
-rw-r--r--util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/util.c b/util.c
index 09128c8..96840e5 100644
--- a/util.c
+++ b/util.c
@@ -270,6 +270,22 @@ char *path_extension(char *path)
return strdup(lastdot+1);
}
+uint8_t path_matches_extensions(char *path, char **ext_list, uint32_t num_exts)
+{
+ char *ext = path_extension(path);
+ if (!ext) {
+ return 0;
+ }
+ uint32_t extidx;
+ for (extidx = 0; extidx < num_exts; extidx++)
+ {
+ if (!strcasecmp(ext, ext_list[extidx])) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
char * path_dirname(char *path)
{
char *lastslash = NULL;