From e435453363bbc35e73bc3359e10ae24d32c5cfc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 15 Mar 2022 22:49:06 +0100 Subject: [PATCH] fix building for nRF52 --- src/FSCommon.cpp | 8 ++++---- src/mesh/http/ContentHandler.cpp | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index cae9556ef..81ff48f2c 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -1,10 +1,10 @@ #include "configuration.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 { - File root = fs.open(dirname); + File root = FSCom.open(dirname); if(!root){ return; } @@ -16,7 +16,7 @@ void listDir(fs::FS &fs, const char * dirname, uint8_t levels) while(file){ if(file.isDirectory()){ if(levels){ - listDir(fs, file.name(), levels -1); + listDir(file.name(), levels -1); } } else { DEBUG_MSG(" %s (%i Bytes)\n", file.name(), file.size()); @@ -38,6 +38,6 @@ void fsInit() } DEBUG_MSG("Filesystem files:\n"); - listDir(FSCom, "/", 10); + listDir("/", 10); #endif } diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index d055db4b6..a186e918e 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -274,9 +274,9 @@ void handleAPIv1ToRadio(HTTPRequest *req, HTTPResponse *res) 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){ return; } @@ -287,13 +287,13 @@ void htmlDeleteDir(fs::FS &fs, const char * dirname) File file = root.openNextFile(); while(file){ if(file.isDirectory()){ - htmlDeleteDir(fs, file.name()); + htmlDeleteDir(file.name()); file.close(); } else { String fileName = String(file.name()); file.close(); DEBUG_MSG(" %s\n", fileName.c_str()); - fs.remove(fileName); + FSCom.remove(fileName); } file = root.openNextFile(); @@ -301,9 +301,9 @@ void htmlDeleteDir(fs::FS &fs, const char * dirname) 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){ return; } @@ -315,7 +315,7 @@ void htmlListDir(fs::FS &fs, HTTPResponse *res, const char * dirname, uint8_t l while(file){ if(file.isDirectory()){ if(levels){ - htmlListDir(fs, res, file.name(), levels -1); + htmlListDir(res, file.name(), levels -1); } } else { if (firstFile) { @@ -350,7 +350,7 @@ void handleFsBrowseStatic(HTTPRequest *req, HTTPResponse *res) res->println("{"); res->println("\"data\": {"); res->print("\"files\": ["); - htmlListDir(FSCom, res, "/", 10); + htmlListDir(res, "/", 10); res->print("],"); res->print("\"filesystem\" : {"); res->print("\"total\" : " + String(FSCom.totalBytes()) + ","); @@ -759,7 +759,7 @@ void handleUpdateFs(HTTPRequest *req, HTTPResponse *res) DEBUG_MSG("Deleting files from /static : \n"); - htmlDeleteDir(FSCom, "/static"); + htmlDeleteDir("/static"); delay(5); // Let other network operations run @@ -832,7 +832,7 @@ void handleDeleteFsContent(HTTPRequest *req, HTTPResponse *res) DEBUG_MSG("Deleting files from /static/* : \n"); - htmlDeleteDir(FSCom, "/static"); + htmlDeleteDir("/static"); res->println("


Back to admin\n"); }