Probably goes without saying that the clue is in the name, but still...
I needed to modify my file iterator to be able to call recursively for directory structures. As you can see below, the files list contains a directory which the editor displays as a file.


I have a working fix for esp8266 that looks like this
void _fileListIterator(FS & fs, const char * dirName, std::function<void(File & f)> Cb );
void SPIFFSEditor::_fileListIterator(FS & fs, const char * dirName, std::function<void(File & f)> Cb )
{
Dir dir = fs.openDir(dirName);
while (dir.next()) {
if (dir.isFile()) {
File f = dir.openFile("r");
if (Cb && f) {
Cb(f);
f.close();
}
} else {
_fileListIterator(fs, dir.fileName().c_str() , Cb);
}
}
}
and finally.. the business end changed to...
void SPIFFSEditor::handleRequest(AsyncWebServerRequest *request){
if(_username.length() && _password.length() && !request->authenticate(_username.c_str(), _password.c_str()))
return request->requestAuthentication();
if(request->method() == HTTP_GET){
if(request->hasParam("list")){
String path = request->getParam("list")->value();
path = String();
String output = "[";
_fileListIterator(_fs, path.c_str(), [&output](File &f) {
if (output != "[") output += ',';
output += "{\"type\":\"";
output += "file";
output += "\",\"name\":\"";
output += String(f.fullName());
output += "\",\"size\":";
output += String(f.size());
output += "}";
});
output += "]";
request->send(200, "application/json", output);
output = String();
} ...
However, I've not used SPIFFS very much with ESP32 and have not developed on it in a very long time. How different are the FS APIs and does ESP32 support LittleFS now / is planning to?
I can make a pull request, should probably change it to FSEditor as well rather than SPIFFS..
Thoughts?
Probably goes without saying that the clue is in the name, but still...
I needed to modify my file iterator to be able to call recursively for directory structures. As you can see below, the files list contains a directory which the editor displays as a file.


I have a working fix for esp8266 that looks like this
and finally.. the business end changed to...
However, I've not used SPIFFS very much with ESP32 and have not developed on it in a very long time. How different are the FS APIs and does ESP32 support LittleFS now / is planning to?
I can make a pull request, should probably change it to FSEditor as well rather than SPIFFS..
Thoughts?