File tree 2 files changed +27
-19
lines changed
2 files changed +27
-19
lines changed Original file line number Diff line number Diff line change @@ -20,13 +20,33 @@ extern "C" {
20
20
#include < dirent.h>
21
21
#include " esp_spiffs.h"
22
22
}
23
+
23
24
#include " SPIFFS.h"
24
25
25
26
using namespace fs ;
26
27
27
- SPIFFSFS::SPIFFSFS (FSImplPtr impl)
28
- : FS(impl)
29
- {}
28
+ class SPIFFSImpl : public VFSImpl
29
+ {
30
+ public:
31
+ SPIFFSImpl ();
32
+ virtual ~SPIFFSImpl () { }
33
+ virtual bool exists (const char * path);
34
+ };
35
+
36
+ SPIFFSImpl::SPIFFSImpl ()
37
+ {
38
+ }
39
+
40
+ bool SPIFFSImpl::exists (const char * path)
41
+ {
42
+ File f = open (path, " r" );
43
+ return (f == true ) && !f.isDirectory ();
44
+ }
45
+
46
+ SPIFFSFS::SPIFFSFS () : FS(FSImplPtr(new SPIFFSImpl()))
47
+ {
48
+
49
+ }
30
50
31
51
bool SPIFFSFS::begin (bool formatOnFail, const char * basePath, uint8_t maxOpenFiles)
32
52
{
@@ -98,16 +118,5 @@ size_t SPIFFSFS::usedBytes()
98
118
return used;
99
119
}
100
120
101
- bool SPIFFSFS::exists (const char * path)
102
- {
103
- File f = open (path, " r" );
104
- return (f == true ) && !f.isDirectory ();
105
- }
106
-
107
- bool SPIFFSFS::exists (const String& path)
108
- {
109
- return exists (path.c_str ());
110
- }
111
-
121
+ SPIFFSFS SPIFFS;
112
122
113
- SPIFFSFS SPIFFS = SPIFFSFS(FSImplPtr(new VFSImpl()));
Original file line number Diff line number Diff line change @@ -22,18 +22,17 @@ namespace fs
22
22
class SPIFFSFS : public FS
23
23
{
24
24
public:
25
- SPIFFSFS (FSImplPtr impl );
25
+ SPIFFSFS ();
26
26
bool begin (bool formatOnFail=false , const char * basePath=" /spiffs" , uint8_t maxOpenFiles=10 );
27
27
bool format ();
28
28
size_t totalBytes ();
29
29
size_t usedBytes ();
30
30
void end ();
31
- bool exists (const char * path);
32
- bool exists (const String& path);
33
31
};
34
32
35
33
}
36
34
37
35
extern fs::SPIFFSFS SPIFFS;
38
36
39
- #endif /* _SPIFFS_H_ */
37
+
38
+ #endif
You can’t perform that action at this time.
0 commit comments