Closed
Description
Hi,
I've tracked down a file seeking issue to this:
ESP32, vfs_api.cpp:
bool VFSFileImpl::seek(uint32_t pos, SeekMode mode)
{
if(_isDirectory || !_f) {
return false;
}
auto rc = fseek(_f, pos, mode);
return rc == 0;
}
ESP8266, spiffs_api.h:
bool seek(uint32_t pos, SeekMode mode) override
{
CHECKFD();
int32_t offset = static_cast<int32_t>(pos);
if (mode == SeekEnd) {
offset = -offset;
}
auto rc = SPIFFS_lseek(_fs->getFs(), _fd, offset, (int) mode);
if (rc < 0) {
DEBUGV("SPIFFS_lseek rc=%d\r\n", rc);
return false;
}
return true;
}
The ESP32 implementation is missing the position to offset conversion (negation) in SeekEnd mode. Could you fix it, please?