From 17a1a24009dbd2f316ff14430b4f56e99565af98 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Sun, 1 Oct 2017 10:27:04 +0800 Subject: [PATCH] fix SPIFFS example --- libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino b/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino index 8a7ca7c2..f77f28e7 100644 --- a/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino +++ b/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino @@ -36,7 +36,7 @@ void readFile(fs::FS &fs, const char * path){ Serial.printf("Reading file: %s\n", path); File file = fs.open(path); - if(!file){ + if(!file || file.isDirectory()){ Serial.println("Failed to open file for reading"); return; } @@ -101,7 +101,7 @@ void testFileIO(fs::FS &fs, const char * path){ size_t len = 0; uint32_t start = millis(); uint32_t end = start; - if(file){ + if(file && !file.isDirectory()){ len = file.size(); size_t flen = len; start = millis();