aboutsummaryrefslogtreecommitdiff
path: root/stmhal
diff options
context:
space:
mode:
authorPaul Sokolovsky2016-02-29 00:44:12 +0200
committerPaul Sokolovsky2016-02-29 00:44:32 +0200
commit6ef65e70af23508be303e46953b323409a2893ab (patch)
treee0f43f1376ff25a5f678d4f7c6a4aa9b6c19b2f1 /stmhal
parenteaa96a76101a1b15de3f96b0ede3d62fc5def6f5 (diff)
extmod/vfs_fat: Add fat_vfs_import_stat(), reusable import stat routine.
Moved from stmhal.
Diffstat (limited to 'stmhal')
-rw-r--r--stmhal/import.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/stmhal/import.c b/stmhal/import.c
index c28fe8762..1edbe2caa 100644
--- a/stmhal/import.c
+++ b/stmhal/import.c
@@ -29,19 +29,8 @@
#include "py/lexer.h"
#include "lib/fatfs/ff.h"
+mp_import_stat_t fat_vfs_import_stat(const char *path);
+
mp_import_stat_t mp_import_stat(const char *path) {
- FILINFO fno;
-#if _USE_LFN
- fno.lfname = NULL;
- fno.lfsize = 0;
-#endif
- FRESULT res = f_stat(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;
+ return fat_vfs_import_stat(path);
}