mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
add rm command to remove file
This commit is contained in:
parent
0f601752e4
commit
a22c176d45
3 changed files with 18 additions and 0 deletions
|
|
@ -52,6 +52,10 @@ File DataStore::openRead(const char* filename) {
|
|||
#endif
|
||||
}
|
||||
|
||||
bool DataStore::removeFile(const char* filename) {
|
||||
return _fs->remove(filename);
|
||||
}
|
||||
|
||||
bool DataStore::formatFileSystem() {
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
return _fs->format();
|
||||
|
|
|
|||
|
|
@ -38,4 +38,5 @@ public:
|
|||
uint8_t getBlobByKey(const uint8_t key[], int key_len, uint8_t dest_buf[]);
|
||||
bool putBlobByKey(const uint8_t key[], int key_len, const uint8_t src_buf[], uint8_t len);
|
||||
File openRead(const char* filename);
|
||||
bool removeFile(const char* filename);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1353,6 +1353,19 @@ void MyMesh::checkCLIRescueCmd() {
|
|||
|
||||
}
|
||||
|
||||
} else if (memcmp(cli_command, "rm ", 3) == 0) {
|
||||
|
||||
// get path from command e.g: "rm /adv_blobs"
|
||||
const char *path = &cli_command[4];
|
||||
|
||||
// remove file
|
||||
bool removed = _store->removeFile(path);
|
||||
if(removed){
|
||||
Serial.println("File removed");
|
||||
} else {
|
||||
Serial.println("Failed to remove file");
|
||||
}
|
||||
|
||||
} else if (strcmp(cli_command, "reboot") == 0) {
|
||||
board.reboot(); // doesn't return
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue