Browse Source

First parse subdirectories, then files (to get main directory to the front of the list)

master
goldsimon 17 years ago
parent
commit
268bb23f11
  1. 31
      apps/httpserver_raw/makefsdata/makefsdata.c

31
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;
}

Loading…
Cancel
Save