AP_Filesystem: Add dir type to fatfs
This commit is contained in:
parent
f62b6bfd18
commit
9592441632
@ -716,6 +716,11 @@ struct dirent *AP_Filesystem::readdir(DIR *dirp)
|
|||||||
len = strlen(fno.fname);
|
len = strlen(fno.fname);
|
||||||
strncpy(d->de.d_name,fno.fname,len);
|
strncpy(d->de.d_name,fno.fname,len);
|
||||||
d->de.d_name[len] = 0;
|
d->de.d_name[len] = 0;
|
||||||
|
if (fno.fattrib & AM_DIR) {
|
||||||
|
d->de.d_type = DT_DIR;
|
||||||
|
} else {
|
||||||
|
d->de.d_type = DT_REG;
|
||||||
|
}
|
||||||
return &d->de;
|
return &d->de;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
#define MAX_NAME_LEN 13
|
#define MAX_NAME_LEN 13
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DT_REG 0
|
||||||
|
#define DT_DIR 1
|
||||||
|
|
||||||
struct dirent {
|
struct dirent {
|
||||||
char d_name[MAX_NAME_LEN]; /* filename */
|
char d_name[MAX_NAME_LEN]; /* filename */
|
||||||
|
uint8_t d_type;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user