mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
extmod/vfs_fat_file: Implement SEEK_CUR for non-zero offset.
CPython doesn't allow SEEK_CUR with non-zero offset for files in text mode, and uPy inherited this behaviour for both text and binary files. It makes sense to provide full support for SEEK_CUR of binary-mode files in uPy, and to do this in a minimal way means also allowing to use SEEK_CUR with non-zero offsets on text-mode files. That seems to be a fair compromise.
This commit is contained in:
committed by
Damien George
parent
df952633ef
commit
7642785881
@@ -134,11 +134,7 @@ STATIC mp_uint_t file_obj_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
|
||||
break;
|
||||
|
||||
case 1: // SEEK_CUR
|
||||
if (s->offset != 0) {
|
||||
*errcode = MP_EOPNOTSUPP;
|
||||
return MP_STREAM_ERROR;
|
||||
}
|
||||
// no-operation
|
||||
f_lseek(&self->fp, f_tell(&self->fp) + s->offset);
|
||||
break;
|
||||
|
||||
case 2: // SEEK_END
|
||||
|
||||
Reference in New Issue
Block a user