ESP32 LittleFS and the Directory Object 'Dir' . Is it missing?

arjen1
Posts: 16
Joined: Sun Aug 06, 2023 4:48 pm

ESP32 LittleFS and the Directory Object 'Dir' . Is it missing?

Postby arjen1 » Sat Aug 10, 2024 10:29 pm

Dear Forum

Trying to port some Esp8266 software to ESP32.

The issue I have is with LittleFS. In the esp8266 I use a type 'Dir', as in

Code: Select all

  Dir dir = LittleFS.openDir(directory);
This object then has some properties like filesize, filecreationtime, filename and whether it is directory or a file.

However, when trying to compile this code for ESP32 I get an error 'error: 'Dir' has not been declared'.

And it seems that the info structure is also not defined for esp32

Code: Select all

  FSInfo fs_info_webserver;
  LittleFS.info(fs_info_webserver);


I have searched for 2 hours now, could not find the solution.

What am i missing? The littlefs lib is fixed in the arduino Ide is it not? Or do i have to install another library?

Your input will be appreciated.

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32 LittleFS and the Directory Object 'Dir' . Is it missing?

Postby lbernstone » Sat Aug 10, 2024 10:47 pm

FS is implemented in a different way on ESP32. The underlying OS is posix-style, so directories are just a different type of file. See the example for more details on how to implement directory scanning and getting filesystem info.

arjen1
Posts: 16
Joined: Sun Aug 06, 2023 4:48 pm

Re: ESP32 LittleFS and the Directory Object 'Dir' . Is it missing?

Postby arjen1 » Sat Aug 10, 2024 11:03 pm

Thanks. I did find this example earlier but was hoping life would be easy :|

I'll look into that and rewrite the bits that differ....

Who is online

Users browsing this forum: Google [Bot] and 170 guests