diff util.c @ 1485:369da70ee2c2 nuklear_ui

Filter file list in Nuklear UI
author Michael Pavone <pavone@retrodev.com>
date Sun, 26 Nov 2017 18:33:36 -0800
parents d82af64c94d2
children c416ace65ff1
line wrap: on
line diff
--- a/util.c	Sun Nov 26 17:33:39 2017 -0800
+++ b/util.c	Sun Nov 26 18:33:36 2017 -0800
@@ -270,6 +270,22 @@
 	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;