summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-05-02 19:17:54 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-05-02 19:17:54 -0400
commitf39b7e1332203b3b9da65d29adc09a37589c8d45 (patch)
tree36529b5888faa51b5833548314bb165b301593ce /src
parenta83e832aeb4719d4638455ced6da2de662a00bca (diff)
add special prioritized files to improve fs loader accuracy
Diffstat (limited to 'src')
-rw-r--r--src/modules/filesystem_loader.c33
1 files 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)
101 101
102 Eina_Iterator *it; 102 Eina_Iterator *it;
103 struct stat st; 103 struct stat st;
104 char buf[PATH_MAX] = {0}; 104 char *file, buf[PATH_MAX] = {0};
105 Eina_Bool isdir; 105 Eina_Bool isdir;
106 Eina_List *files = NULL; 106 Eina_List *l, *ll, *final = NULL, *files = NULL;
107 unsigned int i;
108 const char *special[] =
109 {
110 "cover",
111 "folder",
112 "front"
113 };
114 Eina_List *s[EINA_C_ARRAY_LENGTH(special)] = {NULL};
107 115
108 if (stat(fsi->uri, &st)) return; 116 if (stat(fsi->uri, &st)) return;
109 isdir = S_ISDIR(st.st_mode); 117 isdir = S_ISDIR(st.st_mode);
@@ -133,7 +141,26 @@ fsrun(FSInfo *fsi, Ecore_Thread *eth)
133 } 141 }
134 } 142 }
135 } 143 }
136 ecore_thread_feedback(eth, files); 144 EINA_LIST_FOREACH_SAFE(files, l, ll, file)
145 {
146 char *p;
147
148 p = strrchr(file, '/');
149 if (p) p++;
150 else
151 p = file;
152 for (i = 0; i < EINA_C_ARRAY_LENGTH(special); i++)
153 if (!strncasecmp(p, special[i], strlen(special[i])))
154 {
155 s[i] = eina_list_append(s[i], file);
156 files = eina_list_remove_list(files, l);
157 }
158 }
159 for (i = 0; i < EINA_C_ARRAY_LENGTH(special); i++)
160 if (s[i]) final = eina_list_merge(final, s[i]);
161 if (files)
162 final = eina_list_merge(final, files);
163 ecore_thread_feedback(eth, final);
137} 164}
138 165
139EAPI Eina_Bool 166EAPI Eina_Bool