summaryrefslogtreecommitdiffstatshomepage
path: root/stm/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm/import.c')
-rw-r--r--stm/import.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/stm/import.c b/stm/import.c
new file mode 100644
index 0000000000..3d62c64254
--- /dev/null
+++ b/stm/import.c
@@ -0,0 +1,20 @@
+#include <stdint.h>
+
+#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;
+}