1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Filesystem: fix File::available, add File::name

This commit is contained in:
Ivan Grokhotkov
2015-08-05 07:41:12 -04:00
parent 90efba073f
commit b5d9db91aa
4 changed files with 19 additions and 3 deletions

View File

@ -259,6 +259,12 @@ public:
DEBUGV("SPIFFS_close: fd=%d\r\n", _fd);
}
const char* name() const override {
CHECKFD();
return (const char*) _stat.name;
}
protected:
SPIFFSImpl* _fs;
spiffs_file _fd;
@ -283,10 +289,11 @@ public:
return FileImplPtr();
}
int mode = getSpiffsMode(openMode, accessMode);
spiffs_file fd = SPIFFS_open_by_dirent(_fs->getFs(), &_dirent, mode, 0);
auto fs = _fs->getFs();
spiffs_file fd = SPIFFS_open_by_dirent(fs, &_dirent, mode, 0);
if (fd < 0) {
DEBUGV("SPIFFSDirImpl::openFile: fd=%d path=`%s` openMode=%d accessMode=%d err=%d\r\n",
fd, _dirent.name, openMode, accessMode, _fs.err_code);
fd, _dirent.name, openMode, accessMode, fs->err_code);
return FileImplPtr();
}
return std::make_shared<SPIFFSFileImpl>(_fs, fd);