sforkowany z mirror/meshtastic-firmware
Don't use rmdir_r but roll our own version.
rodzic
b127479961
commit
125f76d984
|
@ -28,6 +28,34 @@ void listDir(const char * dirname, uint8_t levels)
|
|||
#endif
|
||||
}
|
||||
|
||||
void rmDir(const char * dirname)
|
||||
#ifdef FSCom
|
||||
{
|
||||
File root = FSCom.open(dirname);
|
||||
if(!root){
|
||||
return;
|
||||
}
|
||||
if(!root.isDirectory()){
|
||||
return;
|
||||
}
|
||||
|
||||
File file = root.openNextFile();
|
||||
while(file){
|
||||
if(file.isDirectory() && !String(file.name()).endsWith(".")) {
|
||||
file.close();
|
||||
rmDir(file.name());
|
||||
FSCom.rmdir(file.name());
|
||||
} else {
|
||||
file.close();
|
||||
FSCom.remove(file.name());
|
||||
}
|
||||
file.close();
|
||||
file = root.openNextFile();
|
||||
}
|
||||
file.close();
|
||||
#endif
|
||||
}
|
||||
|
||||
void fsInit()
|
||||
{
|
||||
#ifdef FSCom
|
||||
|
|
|
@ -26,4 +26,6 @@
|
|||
using namespace Adafruit_LittleFS_Namespace;
|
||||
#endif
|
||||
|
||||
void fsInit();
|
||||
void fsInit();
|
||||
void listDir(const char * dirname, uint8_t levels);
|
||||
void rmDir(const char * dirname);
|
||||
|
|
|
@ -91,7 +91,7 @@ bool NodeDB::resetRadioConfig()
|
|||
if (config.device.factory_reset) {
|
||||
DEBUG_MSG("Performing factory reset!\n");
|
||||
// first, remove the "/prefs" (this removes most prefs)
|
||||
FSCom.rmdir_r("/prefs");
|
||||
rmDir("/prefs");
|
||||
// second, install default state (this will deal with the duplicate mac address issue)
|
||||
installDefaultDeviceState();
|
||||
// third, write to disk
|
||||
|
|
Ładowanie…
Reference in New Issue