FileManagerModule¶
Lists and deletes state files on the device filesystem. Introduced in Release 4, Sprint 7.
What it does¶
FileManagerModule calls pal::fs_list() every ~1 s via loop1s() to show the current contents of the state directory. A filename text input and a delete button let the operator remove individual state files without restarting the device or using serial access.
On ESP32 the state directory is /state on LittleFS. On PC it is state/ relative to the binary working directory.
Controls¶
| Key | Type | Description |
|---|---|---|
files |
display |
Current directory listing: one filename size line per file |
filename |
text |
Filename to delete (basename only, no path) |
delete |
button |
Delete the file named in filename; result appears in delete_result |
delete_result |
display |
Outcome of the last delete: deleted: <name> or not found: <name> or error: no filename |
The delete button is marked sensitive so it is excluded from WebSocket state broadcasts.
Usage¶
- Read the
filesdisplay to find the file to remove. - Type the basename (e.g.
sine1.json) into thefilenamefield. - Press
delete. - Confirm the file is gone from the updated
fileslisting.
healthReport format¶
state_dir=<path> file_count=<n>
Platform notes¶
ESP32: operates on /state on LittleFS. Only regular files are listed; directories are skipped. LittleFS.remove() returns true on success.
PC: operates on state/ using std::filesystem. The directory is created by the server on first state write; if it does not yet exist fs_list() returns empty.
Footprint¶
| Field | Size |
|---|---|
classSize() |
~2244 B (2048 B file list + 128 B filename + 64 B result + bool + vtable) |
| Heap | 0 (all buffers are inline fields) |
Test coverage¶
Unit tests in tests/test_system_utils.cpp:
| Test | Level | What is verified |
|---|---|---|
| Lifecycle does not crash | smoke |
setup/loop/loop1s/teardown without crash |
| healthReport format | format |
healthReport contains state_dir= and file_count= |
| getSchema exposes files, filename, delete | format |
all three controls in schema with correct types |
| Delete with empty filename | behavioral |
no crash; error reported |
| Delete nonexistent file | behavioral |
no crash; not-found outcome |
| Delete existing file succeeds | behavioral |
file removed from filesystem; confirmed via fopen |