mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Merge pull request #918 from luc-github/esp8266
Add SPIFFS wrapper for info function
This commit is contained in:
commit
e3518a5722
@ -174,6 +174,13 @@ bool FS::format() {
|
|||||||
return _impl->format();
|
return _impl->format();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FS::info(uint32_t *total, uint32_t *used){
|
||||||
|
if (!_impl) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _impl->info(total,used);
|
||||||
|
}
|
||||||
|
|
||||||
File FS::open(const String& path, const char* mode) {
|
File FS::open(const String& path, const char* mode) {
|
||||||
return open(path.c_str(), mode);
|
return open(path.c_str(), mode);
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,7 @@ public:
|
|||||||
bool begin();
|
bool begin();
|
||||||
|
|
||||||
bool format();
|
bool format();
|
||||||
|
bool info(uint32_t *total, uint32_t *used);
|
||||||
|
|
||||||
File open(const char* path, const char* mode);
|
File open(const char* path, const char* mode);
|
||||||
File open(const String& path, const char* mode);
|
File open(const String& path, const char* mode);
|
||||||
|
@ -64,6 +64,7 @@ class FSImpl {
|
|||||||
public:
|
public:
|
||||||
virtual bool begin() = 0;
|
virtual bool begin() = 0;
|
||||||
virtual bool format() = 0;
|
virtual bool format() = 0;
|
||||||
|
virtual bool info(uint32_t *total, uint32_t *used) = 0;
|
||||||
virtual FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) = 0;
|
virtual FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) = 0;
|
||||||
virtual bool exists(const char* path) = 0;
|
virtual bool exists(const char* path) = 0;
|
||||||
virtual DirImplPtr openDir(const char* path) = 0;
|
virtual DirImplPtr openDir(const char* path) = 0;
|
||||||
|
@ -76,6 +76,15 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool info(uint32_t *total, uint32_t *used) override{
|
||||||
|
auto rc = SPIFFS_info(&_fs, total, used);
|
||||||
|
if (rc != SPIFFS_OK) {
|
||||||
|
DEBUGV("SPIFFS_format: rc=%d, err=%d\r\n", rc, _fs.err_code);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool remove(const char* path) override {
|
bool remove(const char* path) override {
|
||||||
char tmpName[SPIFFS_OBJ_NAME_LEN];
|
char tmpName[SPIFFS_OBJ_NAME_LEN];
|
||||||
strlcpy(tmpName, path, sizeof(tmpName));
|
strlcpy(tmpName, path, sizeof(tmpName));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user