1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-24 19:42:27 +03:00

FileSystem: interface changes and some additions

- rename mount to begin to be more in line with other libraries
- add rename and remove methods
- remove freestanding functions (mount,open,openDir) from public API until that part is ready
- fix resource leak in SPIFFSDirImpl
This commit is contained in:
Ivan Grokhotkov
2015-07-30 13:44:34 +03:00
parent 544734bdc5
commit 4aa8e1b8d5
4 changed files with 153 additions and 40 deletions

View File

@ -24,6 +24,9 @@
#include <Arduino.h>
#include <memory>
class File;
class Dir;
class FileImpl;
typedef std::shared_ptr<FileImpl> FileImplPtr;
class FSImpl;
@ -82,25 +85,26 @@ class FS
{
public:
FS(FSImplPtr impl) : _impl(impl) { }
bool begin();
File open(const char* path, const char* mode);
File open(const String& path, const char* mode);
Dir openDir(const char* path);
Dir openDir(const String& path);
bool remove(const char* path);
bool remove(const String& path);
bool rename(const char* pathFrom, const char* pathTo);
bool rename(const String& pathFrom, const String& pathTo);
protected:
FSImplPtr _impl;
template <typename Tfs>
friend bool mount(Tfs& fs, const char* mountPoint);
};
extern FS SPIFFS;
template<>
bool mount<FS>(FS& fs, const char* mountPoint);
File open(const char* path, const char* mode);
Dir openDir(const char* path);
#endif //FS_H