diff --git a/esp32/bindings.fs b/esp32/bindings.fs index 4749e84..2a209a2 100644 --- a/esp32/bindings.fs +++ b/esp32/bindings.fs @@ -15,7 +15,7 @@ ( Migrate various words to separate vocabularies, and constants ) forth definitions internals -: read-dir ( dh -- a n ) dup if errno else 0 then ; +: read-dir ( dh -- a n ) readdir dup if z>s else 0 then ; forth definitions vocabulary ESP ESP definitions diff --git a/esp32/builtins.h b/esp32/builtins.h index cfd901b..e5151f5 100644 --- a/esp32/builtins.h +++ b/esp32/builtins.h @@ -146,7 +146,8 @@ static cell_t ResizeFile(cell_t fd, cell_t size); X("OPEN-DIR", OPEN_DIR, memcpy(filename, a1, n0); filename[n0] = 0; \ n1 = (cell_t) opendir(filename); n0 = n1 ? 0 : errno) \ X("CLOSE-DIR", CLOSE_DIR, n0 = closedir((DIR *) n0); n0 = n0 ? errno : 0) \ - YV(internals, READDIR, SET readdir((DIR *) n0)->d_name) + YV(internals, READDIR, \ + struct dirent *ent = readdir((DIR *) n0); SET (ent ? ent->d_name: 0)) #ifndef ENABLE_LEDC_SUPPORT # define OPTIONAL_LEDC_SUPPORT