circuitpython/stm/import.c
Damien George 46239413d0 stm: Implement mp_import_stat.
To follow up pull request #309.
2014-02-17 22:44:20 +00:00

21 lines
439 B
C

#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;
}