AP_Filesystem: Add dir type to fatfs

This commit is contained in:
Michael du Breuil 2019-09-25 20:41:43 -07:00 committed by Andrew Tridgell
parent d00f4316e9
commit 14bf946fe2
2 changed files with 9 additions and 0 deletions

View File

@ -716,6 +716,11 @@ struct dirent *AP_Filesystem::readdir(DIR *dirp)
len = strlen(fno.fname);
strncpy(d->de.d_name,fno.fname,len);
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;
}

View File

@ -20,6 +20,10 @@
#define MAX_NAME_LEN 13
#endif
#define DT_REG 0
#define DT_DIR 1
struct dirent {
char d_name[MAX_NAME_LEN]; /* filename */
uint8_t d_type;
};