fix: fix ramdisk readdir inconsistency.

This commit is contained in:
2026-08-12 18:35:14 +02:00
parent 7f2d4b693f
commit a28b8ad0b2
8 changed files with 71 additions and 27 deletions
+3 -4
View File
@@ -14,9 +14,8 @@
// App Manifest Scanning
// ============================================================================
// Extract the basename from a readdir entry.
// readdir returns full paths from drive root (e.g. "apps/doom/") —
// strip the directory prefix and any trailing slash to get just "doom".
// Extract the basename from a readdir entry, tolerating both current
// direct-child names and paths returned by older ramdisk kernels.
static void extract_basename(char* out, int outSz, const char* entry) {
// Strip trailing slash
int len = montauk::slen(entry);
@@ -89,7 +88,7 @@ void desktop_scan_apps(DesktopState* ds) {
scanned += got;
for (int i = 0; i < got; i++) {
// readdir returns paths like "apps/doom/" — extract just "doom"
// Strip the directory marker and tolerate old root-relative entries.
char dirname[64];
extract_basename(dirname, sizeof(dirname), entries[i]);
if (dirname[0] == '\0') continue;