discomfitor pushed a commit to branch master.

http://git.enlightenment.org/apps/empc.git/commit/?id=f39b7e1332203b3b9da65d29adc09a37589c8d45

commit f39b7e1332203b3b9da65d29adc09a37589c8d45
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Mon May 2 19:17:54 2016 -0400

    add special prioritized files to improve fs loader accuracy
---
 src/modules/filesystem_loader.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/modules/filesystem_loader.c b/src/modules/filesystem_loader.c
index fd9397e..7d463fe 100644
--- a/src/modules/filesystem_loader.c
+++ b/src/modules/filesystem_loader.c
@@ -101,9 +101,17 @@ fsrun(FSInfo *fsi, Ecore_Thread *eth)
    
    Eina_Iterator *it;
    struct stat st;
-   char buf[PATH_MAX] = {0};
+   char *file, buf[PATH_MAX] = {0};
    Eina_Bool isdir;
-   Eina_List *files = NULL;
+   Eina_List *l, *ll, *final = NULL, *files = NULL;
+   unsigned int i;
+   const char *special[] =
+   {
+      "cover",
+      "folder",
+      "front"
+   };
+   Eina_List *s[EINA_C_ARRAY_LENGTH(special)] = {NULL};
 
    if (stat(fsi->uri, &st)) return;
    isdir = S_ISDIR(st.st_mode);
@@ -133,7 +141,26 @@ fsrun(FSInfo *fsi, Ecore_Thread *eth)
                }
           }
      }
-   ecore_thread_feedback(eth, files);
+   EINA_LIST_FOREACH_SAFE(files, l, ll, file)
+     {
+        char *p;
+
+        p = strrchr(file, '/');
+        if (p) p++;
+        else
+          p = file;
+        for (i = 0; i < EINA_C_ARRAY_LENGTH(special); i++)
+          if (!strncasecmp(p, special[i], strlen(special[i])))
+            {
+               s[i] = eina_list_append(s[i], file);
+               files = eina_list_remove_list(files, l);
+            }
+     }
+   for (i = 0; i < EINA_C_ARRAY_LENGTH(special); i++)
+     if (s[i]) final = eina_list_merge(final, s[i]);
+   if (files)
+     final = eina_list_merge(final, files);
+   ecore_thread_feedback(eth, final);
 }
 
 EAPI Eina_Bool

-- 


Reply via email to