Skip to content

Resolve POSIX adapter paths against the base path - #13

Open
jamiecounsell wants to merge 2 commits into
attermann:masterfrom
zerokelvin-dev:posix-basepath
Open

jamiecounsell wants to merge 2 commits into
attermann:masterfrom
zerokelvin-dev:posix-basepath

Conversation

@jamiecounsell

Copy link
Copy Markdown

Note: this PR is stacked on #12

The POSIX adapter took a base path parameter but ignored it (outside ESP32's LittleFS.begin()), so relative store paths like ./known_store/ resolved against the working directory. On ESP-IDF there is no working directory, so these paths never resolved. The adapter also kept the caller's pointer, which dangles if the string was only temporary.

Now, the adapter keeps its own copy of the base path and resolves future relative paths against it. Absolute paths, and everything when the base path is empty (the default), remain unchanged.

The stdio adapter has the same unused base path. I left it alone to keep this change to one adapter.

Testing: pio test -e native: the new base-path tests pass and fail without the fix. The same three test_file_store tests fail as on master. heltec_wifi_lora_32_V3 builds the adapter with -DUSTORE_USE_POSIXFS. Running in SolarOS on the M9 as the store backend for microReticulum.

jamiecounsell and others added 2 commits October 25, 2026 12:49
rmdir() in the POSIX and stdio adapters returned false when the directory
was removed and true when it wasn't, the opposite of every other adapter
(and of mkdir()).

Adds test/test_posix_fs, which runs the adapters against a real temp
directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019rUgoKJdB4U8fNS9HybY8S
The POSIX adapter took a base path but ignored it (outside ESP32's
LittleFS.begin()), so relative store paths like ./known_store/ resolved
against the working directory. On ESP-IDF there is no working directory,
so these paths never resolved. The adapter also kept the caller's pointer,
which dangles if the string was only temporary.

The adapter now keeps its own copy of the base path and resolves relative
paths against it. Absolute paths, and everything when the base path is
empty (the default), are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019rUgoKJdB4U8fNS9HybY8S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant