From 2492043669404e845cd5700fcddca97c95981506 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Mon, 30 Dec 2019 14:23:14 -0800 Subject: [PATCH] Skip . and .. on LittleFS::dir::rewind() (#6959) Fixes #6958 To match SPIFFS, we get rid of the "." and ".." dirents when we open a directory on LittleFS. Do the same on a rewind(). --- libraries/LittleFS/src/LittleFS.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/LittleFS/src/LittleFS.h b/libraries/LittleFS/src/LittleFS.h index 2a35869ed..9d55cb1fa 100644 --- a/libraries/LittleFS/src/LittleFS.h +++ b/libraries/LittleFS/src/LittleFS.h @@ -567,6 +567,10 @@ public: bool rewind() override { _valid = false; int rc = lfs_dir_rewind(_fs->getFS(), _getDir()); + // Skip the . and .. entries + lfs_info dirent; + lfs_dir_read(_fs->getFS(), _getDir(), &dirent); + lfs_dir_read(_fs->getFS(), _getDir(), &dirent); return (rc == 0); }