mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-16 10:02:05 +00:00
fix building for nRF52
This commit is contained in:
parent
697c749a8d
commit
e435453363
@ -1,10 +1,10 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
|
|
||||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels)
|
void listDir(const char * dirname, uint8_t levels)
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
{
|
{
|
||||||
File root = fs.open(dirname);
|
File root = FSCom.open(dirname);
|
||||||
if(!root){
|
if(!root){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@ void listDir(fs::FS &fs, const char * dirname, uint8_t levels)
|
|||||||
while(file){
|
while(file){
|
||||||
if(file.isDirectory()){
|
if(file.isDirectory()){
|
||||||
if(levels){
|
if(levels){
|
||||||
listDir(fs, file.name(), levels -1);
|
listDir(file.name(), levels -1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG(" %s (%i Bytes)\n", file.name(), file.size());
|
DEBUG_MSG(" %s (%i Bytes)\n", file.name(), file.size());
|
||||||
@ -38,6 +38,6 @@ void fsInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_MSG("Filesystem files:\n");
|
DEBUG_MSG("Filesystem files:\n");
|
||||||
listDir(FSCom, "/", 10);
|
listDir("/", 10);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -274,9 +274,9 @@ void handleAPIv1ToRadio(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
bool firstFile = 1;
|
bool firstFile = 1;
|
||||||
|
|
||||||
void htmlDeleteDir(fs::FS &fs, const char * dirname)
|
void htmlDeleteDir(const char * dirname)
|
||||||
{
|
{
|
||||||
File root = fs.open(dirname);
|
File root = FSCom.open(dirname);
|
||||||
if(!root){
|
if(!root){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -287,13 +287,13 @@ void htmlDeleteDir(fs::FS &fs, const char * dirname)
|
|||||||
File file = root.openNextFile();
|
File file = root.openNextFile();
|
||||||
while(file){
|
while(file){
|
||||||
if(file.isDirectory()){
|
if(file.isDirectory()){
|
||||||
htmlDeleteDir(fs, file.name());
|
htmlDeleteDir(file.name());
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
String fileName = String(file.name());
|
String fileName = String(file.name());
|
||||||
file.close();
|
file.close();
|
||||||
DEBUG_MSG(" %s\n", fileName.c_str());
|
DEBUG_MSG(" %s\n", fileName.c_str());
|
||||||
fs.remove(fileName);
|
FSCom.remove(fileName);
|
||||||
|
|
||||||
}
|
}
|
||||||
file = root.openNextFile();
|
file = root.openNextFile();
|
||||||
@ -301,9 +301,9 @@ void htmlDeleteDir(fs::FS &fs, const char * dirname)
|
|||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void htmlListDir(fs::FS &fs, HTTPResponse *res, const char * dirname, uint8_t levels)
|
void htmlListDir( HTTPResponse *res, const char * dirname, uint8_t levels)
|
||||||
{
|
{
|
||||||
File root = fs.open(dirname);
|
File root = FSCom.open(dirname);
|
||||||
if(!root){
|
if(!root){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ void htmlListDir(fs::FS &fs, HTTPResponse *res, const char * dirname, uint8_t l
|
|||||||
while(file){
|
while(file){
|
||||||
if(file.isDirectory()){
|
if(file.isDirectory()){
|
||||||
if(levels){
|
if(levels){
|
||||||
htmlListDir(fs, res, file.name(), levels -1);
|
htmlListDir(res, file.name(), levels -1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (firstFile) {
|
if (firstFile) {
|
||||||
@ -350,7 +350,7 @@ void handleFsBrowseStatic(HTTPRequest *req, HTTPResponse *res)
|
|||||||
res->println("{");
|
res->println("{");
|
||||||
res->println("\"data\": {");
|
res->println("\"data\": {");
|
||||||
res->print("\"files\": [");
|
res->print("\"files\": [");
|
||||||
htmlListDir(FSCom, res, "/", 10);
|
htmlListDir(res, "/", 10);
|
||||||
res->print("],");
|
res->print("],");
|
||||||
res->print("\"filesystem\" : {");
|
res->print("\"filesystem\" : {");
|
||||||
res->print("\"total\" : " + String(FSCom.totalBytes()) + ",");
|
res->print("\"total\" : " + String(FSCom.totalBytes()) + ",");
|
||||||
@ -759,7 +759,7 @@ void handleUpdateFs(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
DEBUG_MSG("Deleting files from /static : \n");
|
DEBUG_MSG("Deleting files from /static : \n");
|
||||||
|
|
||||||
htmlDeleteDir(FSCom, "/static");
|
htmlDeleteDir("/static");
|
||||||
|
|
||||||
delay(5); // Let other network operations run
|
delay(5); // Let other network operations run
|
||||||
|
|
||||||
@ -832,7 +832,7 @@ void handleDeleteFsContent(HTTPRequest *req, HTTPResponse *res)
|
|||||||
|
|
||||||
DEBUG_MSG("Deleting files from /static/* : \n");
|
DEBUG_MSG("Deleting files from /static/* : \n");
|
||||||
|
|
||||||
htmlDeleteDir(FSCom, "/static");
|
htmlDeleteDir("/static");
|
||||||
|
|
||||||
res->println("<p><hr><p><a href=/admin>Back to admin</a>\n");
|
res->println("<p><hr><p><a href=/admin>Back to admin</a>\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user