Skip to content

List subdirectories, and fix root listing, on embedded filesystems - #1263

Open
meeloo wants to merge 1 commit into
Duet3D:3.7-devfrom
meeloo:upstream/fix-embedded-dir-listing
Open

List subdirectories, and fix root listing, on embedded filesystems#1263
meeloo wants to merge 1 commit into
Duet3D:3.7-devfrom
meeloo:upstream/fix-embedded-dir-listing

Conversation

@meeloo

@meeloo meeloo commented Aug 22, 2026

Copy link
Copy Markdown

Two separate reasons a client saw an empty root on a USE_EMBEDDED_FILES build.

EmbeddedFiles::FindFirst only ever reported files, so directories were invisible even when they existed and could be navigated into directly. It now walks the directory list first and reports immediate children with isDirectory set, then the files.

It also disagreed with its own caller about how to spell the root. MassStorage::DirectoryExists truncates a trailing separator before delegating, so the root arrives as "", while MassStorage::FindFirst passes the path through untouched, so the same request arrives as "/". The empty-root test matched only the first spelling, and "/" matched no directory entry either, so the listing came back empty rather than failing - which is why it looked like "there is nothing there" instead of "the lookup is wrong". FindFirst now normalises the trailing separator itself.

Duet3_MB6HC is unchanged in size; this code is only compiled for embedded-filesystem builds.

Testing note: nothing upstream builds USE_EMBEDDED_FILES, so this cannot be exercised without a build config for the embedded variant. I have one at meeloo/RepRapFirmware:build/embedded-mb6hc-config and can open it as a separate PR, fold it into this one, or leave it out - whichever suits

Two separate reasons a client saw an empty root on a USE_EMBEDDED_FILES build.

EmbeddedFiles::FindFirst only ever reported files, so directories were invisible
even when they existed and could be navigated into directly. It now walks the
directory list first and reports immediate children with isDirectory set, then the
files.

It also disagreed with its own caller about how to spell the root.
MassStorage::DirectoryExists truncates a trailing separator before delegating, so
the root arrives as "", while MassStorage::FindFirst passes the path through
untouched, so the same request arrives as "/". The empty-root test matched only the
first spelling, and "/" matched no directory entry either, so the listing came back
empty rather than failing - which is why it looked like "there is nothing there"
instead of "the lookup is wrong". FindFirst now normalises the trailing separator
itself.

Duet3_MB6HC is unchanged in size (text 998468); this code is only compiled for
embedded-filesystem builds.
@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@meeloo

meeloo commented Aug 22, 2026

Copy link
Copy Markdown
Author

I have read the Duet3D CLA v2.0 and I hereby sign it

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