simplify list files, ensure all entries get recursed

This commit is contained in:
wntrmute 2011-07-27 19:02:04 +00:00
parent 17f9e422d3
commit 651672bf7a
1 changed files with 2 additions and 6 deletions

View File

@ -56,11 +56,7 @@ static void list_files(const char *filepath, ListCallback list_callback)
hFind = FsReadFirst(DirSpec, &entry); hFind = FsReadFirst(DirSpec, &entry);
if (hFind == NULL) return; if (hFind == NULL) return;
fname = (strlen(entry.cAlternateFileName)>0) ? entry.cAlternateFileName : entry.cFileName; do {
list_callback(&entry,EListCallbackArg_Item);
while (FsReadNext(hFind, &entry) != 0)
{
fname = (strlen(entry.cAlternateFileName)>0) ? entry.cAlternateFileName : entry.cFileName; fname = (strlen(entry.cAlternateFileName)>0) ? entry.cAlternateFileName : entry.cFileName;
list_callback(&entry,EListCallbackArg_Item); list_callback(&entry,EListCallbackArg_Item);
printf("cflash added %s\n",entry.cFileName); printf("cflash added %s\n",entry.cFileName);
@ -74,7 +70,7 @@ static void list_files(const char *filepath, ListCallback list_callback)
list_callback(&entry, EListCallbackArg_Pop); list_callback(&entry, EListCallbackArg_Pop);
} }
} }
} } while (FsReadNext(hFind, &entry) != 0);
dwError = FsError(); dwError = FsError();
FsClose(hFind); FsClose(hFind);