2014-03-20 23:33:30 +00:00
|
|
|
#include <stdio.h>
|
2014-03-13 01:06:26 +00:00
|
|
|
#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;
|
2014-03-20 23:33:30 +00:00
|
|
|
#if _USE_LFN
|
|
|
|
fno.lfname = NULL;
|
|
|
|
fno.lfsize = 0;
|
|
|
|
#endif
|
2014-03-13 01:06:26 +00:00
|
|
|
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;
|
|
|
|
}
|