From 8be2c20a4fba2ef13da67547c1ff47ae20cc1b75 Mon Sep 17 00:00:00 2001 From: Tuan PM Date: Wed, 4 Jan 2017 16:27:20 +0700 Subject: [PATCH] change method to find '/' as the suggestion of @sheinz --- extras/spiffs/mkspiffs/mkspiffs.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/extras/spiffs/mkspiffs/mkspiffs.c b/extras/spiffs/mkspiffs/mkspiffs.c index e63cd44..cbebb02 100644 --- a/extras/spiffs/mkspiffs/mkspiffs.c +++ b/extras/spiffs/mkspiffs/mkspiffs.c @@ -199,13 +199,9 @@ static bool process_directory(const char *direcotry) } sprintf(path, "%s/%s", direcotry, ep->d_name); filename = path; - file_ptr = path; - while(*file_ptr != 0 && *file_ptr != '/') { - file_ptr ++; - } - if(*file_ptr != 0) { - filename = file_ptr + 1; - } + filename = strchr(path, '/'); + filename = filename ? &filename[1] : path; + printf("Processing file source %s, dest: %s\n", path, filename); if (!process_file(path, filename)) { printf("Error processing file\n");