return alphasort(d1, d2);\r
}\r
\r
+static char *filter_exts[] = { ".mp3", ".MP3", ".srm", ".brm", "s.gz", ".mds", "bcfg", ".txt", ".htm", "html", ".gpe" };\r
+\r
+static int scandir_filter(const struct dirent *ent)\r
+{\r
+ const char *p;\r
+ int i;\r
+\r
+ if (ent == NULL || ent->d_name == NULL) return 0;\r
+ if (strlen(ent->d_name) < 5) return 1;\r
+\r
+ p = ent->d_name + strlen(ent->d_name) - 4;\r
+\r
+ for (i = 0; i < sizeof(filter_exts)/sizeof(filter_exts[0]); i++)\r
+ {\r
+ if (strcmp(p, filter_exts[i]) == 0) return 0;\r
+ }\r
+\r
+ return 1;\r
+}\r
\r
static char *romsel_loop(char *curr_path)\r
{\r
fname = p+1;\r
}\r
\r
- n = scandir(curr_path, &namelist, 0, scandir_cmp);\r
+ n = scandir(curr_path, &namelist, scandir_filter, scandir_cmp);\r
if (n < 0) {\r
// try root\r
- n = scandir(curr_path, &namelist, 0, scandir_cmp);\r
+ n = scandir("/", &namelist, scandir_filter, scandir_cmp);\r
if (n < 0) {\r
// oops, we failed\r
printf("dir: "); printf(curr_path); printf("\n");\r