1.31 release
authornotaz <notasas@gmail.com>
Sun, 25 Mar 2007 22:21:21 +0000 (22:21 +0000)
committernotaz <notasas@gmail.com>
Sun, 25 Mar 2007 22:21:21 +0000 (22:21 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@80 be3aeb3a-fb24-0410-a615-afba39da0efa

gp2x/menu.c
gp2x/version.h

index 47b91b1..30f681a 100644 (file)
@@ -286,6 +286,25 @@ static int scandir_cmp(const void *p1, const void *p2)
        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
@@ -305,10 +324,10 @@ static char *romsel_loop(char *curr_path)
                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
index 7bb0de2..1725e8d 100644 (file)
@@ -1,2 +1,2 @@
-#define VERSION "1.30"\r
+#define VERSION "1.31"\r
 \r