diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index bf6d7b53..e2817045 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -817,6 +817,9 @@ public: #if defined(NRF52_PLATFORM) _identity_store = new IdentityStore(fs, ""); + #elif defined(RP2040_PLATFORM) + _identity_store = new IdentityStore(fs, "/identity"); + _identity_store->begin(); #else _identity_store = new IdentityStore(fs, "/identity"); #endif diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index b3049546..1e012b58 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -651,6 +651,7 @@ void setup() { LittleFS.begin(); fs = &LittleFS; IdentityStore store(LittleFS, "/identity"); + store.begin(); #else #error "need to define filesystem" #endif diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index 13296335..a607f202 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -889,6 +889,7 @@ void setup() { LittleFS.begin(); fs = &LittleFS; IdentityStore store(LittleFS, "/identity"); + store.begin(); #elif defined(ESP32) SPIFFS.begin(true); fs = &SPIFFS; diff --git a/examples/simple_secure_chat/main.cpp b/examples/simple_secure_chat/main.cpp index 7a80cb81..30bb52bd 100644 --- a/examples/simple_secure_chat/main.cpp +++ b/examples/simple_secure_chat/main.cpp @@ -295,6 +295,9 @@ public: #if defined(NRF52_PLATFORM) IdentityStore store(fs, ""); + #elif defined(RP2040_PLATFORM) + IdentityStore store(fs, "/identity"); + store.begin(); #else IdentityStore store(fs, "/identity"); #endif diff --git a/src/helpers/IdentityStore.h b/src/helpers/IdentityStore.h index 7607fa5b..35b56d97 100644 --- a/src/helpers/IdentityStore.h +++ b/src/helpers/IdentityStore.h @@ -18,7 +18,7 @@ class IdentityStore { public: IdentityStore(FILESYSTEM& fs, const char* dir): _fs(&fs), _dir(dir) { } - void begin() { _fs->mkdir(_dir); } + void begin() { if (_dir && _dir[0] == '/') { _fs->mkdir(_dir); } } bool load(const char *name, mesh::LocalIdentity& id); bool load(const char *name, mesh::LocalIdentity& id, char display_name[], int max_name_sz); bool save(const char *name, const mesh::LocalIdentity& id);