File tree 4 files changed +17
-0
lines changed
hardware/esp8266com/esp8266/cores/esp8266
4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,14 @@ String Dir::fileName() {
144
144
return _impl->fileName ();
145
145
}
146
146
147
+ size_t Dir::fileSize () {
148
+ if (!_impl) {
149
+ return 0 ;
150
+ }
151
+
152
+ return _impl->fileSize ();
153
+ }
154
+
147
155
bool Dir::next () {
148
156
if (!_impl) {
149
157
return false ;
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ class Dir {
78
78
79
79
File openFile (const char * mode);
80
80
String fileName ();
81
+ size_t fileSize ();
81
82
bool next ();
82
83
83
84
protected:
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ class DirImpl {
56
56
virtual ~DirImpl () { }
57
57
virtual FileImplPtr openFile (OpenMode openMode, AccessMode accessMode) = 0;
58
58
virtual const char * fileName () = 0;
59
+ virtual size_t fileSize () = 0;
59
60
virtual bool next () = 0;
60
61
};
61
62
Original file line number Diff line number Diff line change @@ -308,6 +308,13 @@ class SPIFFSDirImpl : public DirImpl {
308
308
return (const char *) _dirent.name ;
309
309
}
310
310
311
+ size_t fileSize () override {
312
+ if (!_valid)
313
+ return 0 ;
314
+
315
+ return _dirent.size ;
316
+ }
317
+
311
318
bool next () override {
312
319
spiffs_dirent* result = SPIFFS_readdir (&_dir, &_dirent);
313
320
_valid = (result != nullptr );
You can’t perform that action at this time.
0 commit comments