diff options
author | Tim Keller <geekboy1011@gmail.com> | 2021-10-26 03:42:34 +0000 |
---|---|---|
committer | Tim Keller <geekboy1011@gmail.com> | 2021-12-10 01:18:57 +0000 |
commit | 8f46908d387cc4fe3f911bc0ca517719238418ed (patch) | |
tree | a187cd93568e5d4e85722923eba0176082b140c9 /src/components/fs/FS.cpp | |
parent | f4322841ffc011ea5c541e40e6aa73ab11ebd988 (diff) |
Fix lvgl_open to respect littlefs open errors
Diffstat (limited to 'src/components/fs/FS.cpp')
-rw-r--r-- | src/components/fs/FS.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/components/fs/FS.cpp b/src/components/fs/FS.cpp index 79fb2222..78b0f5cb 100644 --- a/src/components/fs/FS.cpp +++ b/src/components/fs/FS.cpp @@ -141,16 +141,17 @@ int FS::SectorRead(const struct lfs_config* c, lfs_block_t block, lfs_off_t off, namespace { lv_fs_res_t lvglOpen(lv_fs_drv_t* drv, void* file_p, const char* path, lv_fs_mode_t mode) { - lfs_file_t* file = static_cast<lfs_file_t*>(file_p); FS* filesys = static_cast<FS*>(drv->user_data); - filesys->FileOpen(file, path, LFS_O_RDONLY); - - if (file->type == 0) { - return LV_FS_RES_FS_ERR; - } else { - return LV_FS_RES_OK; + int res = filesys->FileOpen(file, path, LFS_O_RDONLY); + if (res == 0) { + if (file->type == 0) { + return LV_FS_RES_FS_ERR; + } else { + return LV_FS_RES_OK; + } } + return LV_FS_RES_NOT_EX; } lv_fs_res_t lvglClose(lv_fs_drv_t* drv, void* file_p) { |