diff options
author | Damien George <damien.p.george@gmail.com> | 2018-02-23 17:24:57 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-02-23 17:24:57 +1100 |
commit | 638b860066ddf6a684ce2d573917b3c8a5817ba2 (patch) | |
tree | 3a4f4c49146ee15075543e3edc0083743e99d204 /extmod/vfs_fat.c | |
parent | ae4a07730af7fe4f62f9f61e8b600e39f557925e (diff) |
extmod/vfs_fat: Merge remaining vfs_fat_misc.c code into vfs_fat.c.
The only function left in vfs_fat_misc.c is fat_vfs_import_stat() which
can logically go into vfs_fat.c, allowing to remove vfs_fat_misc.c.
Diffstat (limited to 'extmod/vfs_fat.c')
-rw-r--r-- | extmod/vfs_fat.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 58af0a8e8..e696e0fa8 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -47,6 +47,20 @@ #define mp_obj_fat_vfs_t fs_user_mount_t +mp_import_stat_t fat_vfs_import_stat(fs_user_mount_t *vfs, const char *path) { + FILINFO fno; + assert(vfs != NULL); + FRESULT res = f_stat(&vfs->fatfs, path, &fno); + if (res == FR_OK) { + if ((fno.fattrib & AM_DIR) != 0) { + return MP_IMPORT_STAT_DIR; + } else { + return MP_IMPORT_STAT_FILE; + } + } + return MP_IMPORT_STAT_NO_EXIST; +} + STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); |