fix SPIFFS example

This commit is contained in:
me-no-dev 2017-10-01 10:27:04 +08:00
parent d208a36836
commit 17a1a24009

View File

@ -36,7 +36,7 @@ void readFile(fs::FS &fs, const char * path){
Serial.printf("Reading file: %s\n", path); Serial.printf("Reading file: %s\n", path);
File file = fs.open(path); File file = fs.open(path);
if(!file){ if(!file || file.isDirectory()){
Serial.println("Failed to open file for reading"); Serial.println("Failed to open file for reading");
return; return;
} }
@ -101,7 +101,7 @@ void testFileIO(fs::FS &fs, const char * path){
size_t len = 0; size_t len = 0;
uint32_t start = millis(); uint32_t start = millis();
uint32_t end = start; uint32_t end = start;
if(file){ if(file && !file.isDirectory()){
len = file.size(); len = file.size();
size_t flen = len; size_t flen = len;
start = millis(); start = millis();