Virtual File System and "directory listing"

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

Re: Virtual File System and "directory listing"

Postby ESP_igrr » Tue Jun 27, 2017 2:34 pm

If I have a use case for only one file system and want to mount it at "/" then it would then seem to be desirable to be able to perform a directory listing at "/".
That should work currently, because this falls into the "listing for paths which match one of the registered filesystems" case.

However if you register a file system with "/sdcard" prefix, and try to perform opendir("/"), that will not work, in the sense that it will not list "sdcard" as a sub-directory.

mattb351
Posts: 1
Joined: Tue May 25, 2021 2:15 am

Re: Virtual File System and "directory listing"

Postby mattb351 » Tue May 25, 2021 2:25 am

Are there any functions that let me see what virtual file systems are mounted? I mounted spiffs on /spiffs and that works.
I have implemented ls, cat, pwd, df, cd, etc.
If I do an opendir("/spiffs") it returns a valid dir and I can use readdir_r to iterate though and list all the files. If I try to do opendir("/") it fails so it looks like there's no concept of a root directory in the vfs.

What I want to do is make a vfs and mount it on "/". When opendir is called I can catch it in my vfs functions and make the readdir_r work. This is why I thought there may be functions to find out what is mounted. If not I can find the code and modify it but we're trying to use standard esp base code and not have to check in changes to the esp libraries.

Who is online

Users browsing this forum: biakss, Google [Bot] and 139 guests