From 46239413d033a25662700ba39a97b07737b820fc Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 17 Feb 2014 22:44:20 +0000 Subject: stm: Implement mp_import_stat. To follow up pull request #309. --- stm/import.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 stm/import.c (limited to 'stm/import.c') diff --git a/stm/import.c b/stm/import.c new file mode 100644 index 000000000..3d62c6425 --- /dev/null +++ b/stm/import.c @@ -0,0 +1,20 @@ +#include + +#include "misc.h" +#include "mpconfig.h" +#include "qstr.h" +#include "lexer.h" +#include "ff.h" + +mp_import_stat_t mp_import_stat(const char *path) { + FILINFO fno; + 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; +} -- cgit v1.2.3