Need to call close while listing files in SPIFFS with openNextFile

anteph
Posts: 16
Joined: Mon May 08, 2017 2:12 pm

Need to call close while listing files in SPIFFS with openNextFile

Postby anteph » Sun Mar 24, 2019 7:03 pm

Hi,

I've been taking a look at the SPIFFS example from the Arduino core, in particular to the listDir function:
https://github.com/espressif/arduino-es ... est.ino#L9

I've noticed that the procedure doesn't make any call to the close method. It just keeps calling the openNextFile method until there are no more files available.

Isn't a call to the close method needed to make sure no resources are left hanging?

I've taken a look at the implementation of the openNextFile function in the Arduino core, but it doesn't seem to be doing any implicit call to close the file:
https://github.com/espressif/arduino-es ... i.cpp#L384

Nonetheless, I'm not sure what happens in the lower layers (IDF / SPIFFS).

It would be awesome if someone could help clarifying this :)

Best regards,
Nuno Santos

Who is online

Users browsing this forum: Bing [Bot] and 40 guests