From 268bb23f1172467d8c45d12af0dc0b1a02696a4c Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 1 Nov 2009 19:22:45 +0000 Subject: [PATCH] First parse subdirectories, then files (to get main directory to the front of the list) --- apps/httpserver_raw/makefsdata/makefsdata.c | 31 +++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/httpserver_raw/makefsdata/makefsdata.c b/apps/httpserver_raw/makefsdata/makefsdata.c index 4543f07..de4332d 100644 --- a/apps/httpserver_raw/makefsdata/makefsdata.c +++ b/apps/httpserver_raw/makefsdata/makefsdata.c @@ -186,21 +186,6 @@ int process_sub(FILE *data_file, FILE *struct_file) int filesProcessed = 0; char oldSubdir[MAX_PATH_LEN]; - fret = FINDFIRST_FILE("*.*", &fInfo); - if (FINDFIRST_SUCCEEDED(fret)) { - /* at least one file in directory */ - do { - if (FIND_T_IS_FILE(fInfo)) { - const char *curName = FIND_T_FILENAME(fInfo); - printf("processing %s/%s..." NEWLINE, curSubdir, curName); - if (process_file(data_file, struct_file, curName) < 0) { - printf(NEWLINE "Error... aborting" NEWLINE); - return -1; - } - filesProcessed++; - } - } while (FINDNEXT_SUCCEEDED(FINDNEXT(fret, &fInfo))); - } if (processSubs) { /* process subs recursively */ strcpy(oldSubdir, curSubdir); @@ -222,6 +207,22 @@ int process_sub(FILE *data_file, FILE *struct_file) } while (FINDNEXT_SUCCEEDED(FINDNEXT(fret, &fInfo))); } } + + fret = FINDFIRST_FILE("*.*", &fInfo); + if (FINDFIRST_SUCCEEDED(fret)) { + /* at least one file in directory */ + do { + if (FIND_T_IS_FILE(fInfo)) { + const char *curName = FIND_T_FILENAME(fInfo); + printf("processing %s/%s..." NEWLINE, curSubdir, curName); + if (process_file(data_file, struct_file, curName) < 0) { + printf(NEWLINE "Error... aborting" NEWLINE); + return -1; + } + filesProcessed++; + } + } while (FINDNEXT_SUCCEEDED(FINDNEXT(fret, &fInfo))); + } return filesProcessed; }