mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-30 11:23:53 +00:00
Don't use rmdir_r but roll our own version.
This commit is contained in:
parent
b127479961
commit
125f76d984
@ -28,6 +28,34 @@ void listDir(const char * dirname, uint8_t levels)
|
|||||||
#endif
|
#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()
|
void fsInit()
|
||||||
{
|
{
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
|
@ -27,3 +27,5 @@ using namespace Adafruit_LittleFS_Namespace;
|
|||||||
#endif
|
#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) {
|
if (config.device.factory_reset) {
|
||||||
DEBUG_MSG("Performing factory reset!\n");
|
DEBUG_MSG("Performing factory reset!\n");
|
||||||
// first, remove the "/prefs" (this removes most prefs)
|
// 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)
|
// second, install default state (this will deal with the duplicate mac address issue)
|
||||||
installDefaultDeviceState();
|
installDefaultDeviceState();
|
||||||
// third, write to disk
|
// third, write to disk
|
||||||
|
Loading…
Reference in New Issue
Block a user