mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
optimize removing setting files for LittleFS
This commit is contained in:
@@ -15,7 +15,7 @@ void FactoryResetService::handleRequest(AsyncWebServerRequest* request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete function assumes that all files are stored flat, within the config directory
|
* Delete function assumes that all files are stored flat, within the config directory.
|
||||||
*/
|
*/
|
||||||
void FactoryResetService::factoryReset() {
|
void FactoryResetService::factoryReset() {
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
@@ -27,7 +27,10 @@ void FactoryResetService::factoryReset() {
|
|||||||
#elif defined(ESP8266)
|
#elif defined(ESP8266)
|
||||||
Dir configDirectory = fs->openDir(FS_CONFIG_DIRECTORY);
|
Dir configDirectory = fs->openDir(FS_CONFIG_DIRECTORY);
|
||||||
while (configDirectory.next()) {
|
while (configDirectory.next()) {
|
||||||
fs->remove(configDirectory.fileName());
|
String path = FS_CONFIG_DIRECTORY;
|
||||||
|
path.concat("/");
|
||||||
|
path.concat(configDirectory.fileName());
|
||||||
|
fs->remove(path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
RestartService::restartNow();
|
RestartService::restartNow();
|
||||||
|
|||||||
Reference in New Issue
Block a user