mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-23 19:21:59 +03:00
Add SPIFFS::end (#1657)
This commit is contained in:
@ -167,6 +167,12 @@ bool FS::begin() {
|
||||
return _impl->begin();
|
||||
}
|
||||
|
||||
void FS::end() {
|
||||
if (_impl) {
|
||||
_impl->end();
|
||||
}
|
||||
}
|
||||
|
||||
bool FS::format() {
|
||||
if (!_impl) {
|
||||
return false;
|
||||
|
@ -102,7 +102,8 @@ public:
|
||||
FS(FSImplPtr impl) : _impl(impl) { }
|
||||
|
||||
bool begin();
|
||||
|
||||
void end();
|
||||
|
||||
bool format();
|
||||
bool info(FSInfo& info);
|
||||
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
class FSImpl {
|
||||
public:
|
||||
virtual bool begin() = 0;
|
||||
virtual void end() = 0;
|
||||
virtual bool format() = 0;
|
||||
virtual bool info(FSInfo& info) = 0;
|
||||
virtual FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) = 0;
|
||||
|
@ -132,6 +132,14 @@ public:
|
||||
return _tryMount();
|
||||
}
|
||||
|
||||
void end() override
|
||||
{
|
||||
if (SPIFFS_mounted(&_fs) == 0) {
|
||||
return;
|
||||
}
|
||||
SPIFFS_unmount(&_fs);
|
||||
}
|
||||
|
||||
bool format() override
|
||||
{
|
||||
if (_size == 0) {
|
||||
|
Reference in New Issue
Block a user