Skip to content

Commit 17a1a24

Browse files
committed
fix SPIFFS example
1 parent d208a36 commit 17a1a24

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void readFile(fs::FS &fs, const char * path){
3636
Serial.printf("Reading file: %s\n", path);
3737

3838
File file = fs.open(path);
39-
if(!file){
39+
if(!file || file.isDirectory()){
4040
Serial.println("Failed to open file for reading");
4141
return;
4242
}
@@ -101,7 +101,7 @@ void testFileIO(fs::FS &fs, const char * path){
101101
size_t len = 0;
102102
uint32_t start = millis();
103103
uint32_t end = start;
104-
if(file){
104+
if(file && !file.isDirectory()){
105105
len = file.size();
106106
size_t flen = len;
107107
start = millis();

0 commit comments

Comments
 (0)