[Answered] Using opendir() on a FATFS VFS file system.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

[Answered] Using opendir() on a FATFS VFS file system.

Postby kolban » Sat May 20, 2017 10:17 pm

I have create a FATFS VFS file system and mounted it at "/spiflash". When I attempt to use opendir("/spiflash") I get a failure (errno=2) however if I attempt to open a directory within my mounted file system (eg. opendir("/spiflash/myDir")) I get no error.

So my question becomes one of "Can I use opendir() on the root directory of a mounted FATFS/VFS file system?"
Last edited by kolban on Mon May 22, 2017 12:10 am, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Using opendir() on a FATFS VFS file system.

Postby ESP_igrr » Sat May 20, 2017 10:29 pm

You may possibly have to call opendir("/spiflash/"). The fact that the form without the trailing slash doesn't work is likely a bug in VFS. Thanks for reporting.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Using opendir() on a FATFS VFS file system.

Postby kolban » Mon May 22, 2017 12:09 am

Thank you sir. Using opendir("/spiflash/") worked as you suggested.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: endi83 and 137 guests