From ceaed2dc86de2ed242aab4dd02c1f34e064583b3 Mon Sep 17 00:00:00 2001 From: Leon Chan Date: Tue, 6 Jul 2021 16:00:13 +0800 Subject: [PATCH] feat: add file type support for LfsStat close #I3ZCDR Signed-off-by: Leon Chan --- components/fs/littlefs/lfs_api.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/fs/littlefs/lfs_api.c b/components/fs/littlefs/lfs_api.c index 5b4955e8..9250adeb 100644 --- a/components/fs/littlefs/lfs_api.c +++ b/components/fs/littlefs/lfs_api.c @@ -743,6 +743,11 @@ int LfsStat(const char *path, struct stat *buf) ret = lfs_stat(&(fileOpInfo->lfsInfo), path, &info); if (ret == 0) { buf->st_size = info.size; + if (info.type == LFS_TYPE_REG) { + buf->st_mode = S_IFREG; + } else { + buf->st_mode = S_IFDIR; + } } else { errno = LittlefsErrno(ret); ret = VFS_ERROR;