2021-06-27 17:56:28 +00:00
|
|
|
#include "configuration.h"
|
2020-11-19 01:25:02 +00:00
|
|
|
#include "FSCommon.h"
|
|
|
|
|
2022-03-15 21:22:05 +00:00
|
|
|
void listDir(fs::FS &fs, const char * dirname, uint8_t levels)
|
|
|
|
#ifdef FSCom
|
|
|
|
{
|
|
|
|
File root = fs.open(dirname);
|
|
|
|
if(!root){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(!root.isDirectory()){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
File file = root.openNextFile();
|
|
|
|
while(file){
|
|
|
|
if(file.isDirectory()){
|
|
|
|
if(levels){
|
|
|
|
listDir(fs, file.name(), levels -1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
DEBUG_MSG(" %s (%i Bytes)\n", file.name(), file.size());
|
|
|
|
}
|
|
|
|
file.close();
|
|
|
|
file = root.openNextFile();
|
|
|
|
}
|
|
|
|
file.close();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-11-19 01:25:02 +00:00
|
|
|
void fsInit()
|
|
|
|
{
|
2022-02-14 17:45:29 +00:00
|
|
|
#ifdef FSCom
|
|
|
|
if (!FSBegin())
|
2020-11-19 01:25:02 +00:00
|
|
|
{
|
2022-03-15 21:22:05 +00:00
|
|
|
DEBUG_MSG("ERROR filesystem mount Failed. Formatting...\n");
|
2020-11-19 01:25:02 +00:00
|
|
|
assert(0); // FIXME - report failure to phone
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_MSG("Filesystem files:\n");
|
2022-03-15 21:22:05 +00:00
|
|
|
listDir(FSCom, "/", 10);
|
2020-11-19 01:25:02 +00:00
|
|
|
#endif
|
|
|
|
}
|