From 019855ff90b863dc06cd80f04594c4b2f7099455 Mon Sep 17 00:00:00 2001 From: Andreas Merkle Date: Fri, 30 Aug 2024 17:01:23 +0200 Subject: [PATCH] fix(littlefs): Use VFSImpl::exists() to avoid false error log (#10217) * fix(littlefs): Use VFSImpl::exists() to avoid false error log * fix(ffat): Use VFSImpl::exists() to avoid false error log --------- Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> --- libraries/FFat/src/FFat.cpp | 9 --------- libraries/FFat/src/FFat.h | 2 -- libraries/LittleFS/src/LittleFS.cpp | 6 ------ 3 files changed, 17 deletions(-) diff --git a/libraries/FFat/src/FFat.cpp b/libraries/FFat/src/FFat.cpp index 1227e1726..506cc70be 100644 --- a/libraries/FFat/src/FFat.cpp +++ b/libraries/FFat/src/FFat.cpp @@ -152,13 +152,4 @@ size_t F_Fat::freeBytes() { return free_sect * sect_size; } -bool F_Fat::exists(const char *path) { - File f = open(path, "r", false); - return (f == true) && !f.isDirectory(); -} - -bool F_Fat::exists(const String &path) { - return exists(path.c_str()); -} - F_Fat FFat = F_Fat(FSImplPtr(new VFSImpl())); diff --git a/libraries/FFat/src/FFat.h b/libraries/FFat/src/FFat.h index 70cff69dc..3f7003967 100644 --- a/libraries/FFat/src/FFat.h +++ b/libraries/FFat/src/FFat.h @@ -32,8 +32,6 @@ public: size_t usedBytes(); size_t freeBytes(); void end(); - bool exists(const char *path); - bool exists(const String &path); private: wl_handle_t _wl_handle = WL_INVALID_HANDLE; diff --git a/libraries/LittleFS/src/LittleFS.cpp b/libraries/LittleFS/src/LittleFS.cpp index b57763723..e0e71aacf 100644 --- a/libraries/LittleFS/src/LittleFS.cpp +++ b/libraries/LittleFS/src/LittleFS.cpp @@ -33,16 +33,10 @@ class LittleFSImpl : public VFSImpl { public: LittleFSImpl(); virtual ~LittleFSImpl() {} - virtual bool exists(const char *path); }; LittleFSImpl::LittleFSImpl() {} -bool LittleFSImpl::exists(const char *path) { - File f = open(path, "r", false); - return (f == true); -} - LittleFSFS::LittleFSFS() : FS(FSImplPtr(new LittleFSImpl())), partitionLabel_(NULL) {} LittleFSFS::~LittleFSFS() {