diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-07-11 16:07:44 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-07-11 16:07:44 +1000 |
| commit | d974ee1c2fc3256ab367eeeb020921f8a5b0dd61 (patch) | |
| tree | d8caa9816c0b78974060726f917b8a7d911edcaa | |
| parent | 3ab2f3fb2b807a49cf4835cfff7b5e5139a1da76 (diff) | |
extmod/vfs_posix: Use DTTOIF if available to convert type in ilistdir.
| -rw-r--r-- | extmod/vfs_posix.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extmod/vfs_posix.c b/extmod/vfs_posix.c index 2810bdd14..4ca7f9b90 100644 --- a/extmod/vfs_posix.c +++ b/extmod/vfs_posix.c @@ -192,6 +192,9 @@ STATIC mp_obj_t vfs_posix_ilistdir_it_iternext(mp_obj_t self_in) { } #ifdef _DIRENT_HAVE_D_TYPE + #ifdef DTTOIF + t->items[1] = MP_OBJ_NEW_SMALL_INT(DTTOIF(dirent->d_type)); + #else if (dirent->d_type == DT_DIR) { t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFDIR); } else if (dirent->d_type == DT_REG) { @@ -199,10 +202,12 @@ STATIC mp_obj_t vfs_posix_ilistdir_it_iternext(mp_obj_t self_in) { } else { t->items[1] = MP_OBJ_NEW_SMALL_INT(dirent->d_type); } + #endif #else // DT_UNKNOWN should have 0 value on any reasonable system t->items[1] = MP_OBJ_NEW_SMALL_INT(0); #endif + #ifdef _DIRENT_HAVE_D_INO t->items[2] = MP_OBJ_NEW_SMALL_INT(dirent->d_ino); #else |
