Browse Source

AP_Filesystem: Add dir type to fatfs

master
Michael du Breuil 5 years ago committed by Randy Mackay
parent
commit
9592441632
  1. 5
      libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp
  2. 4
      libraries/AP_Filesystem/AP_Filesystem_FATFS.h

5
libraries/AP_Filesystem/AP_Filesystem_FATFS.cpp

@ -716,6 +716,11 @@ struct dirent *AP_Filesystem::readdir(DIR *dirp) @@ -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;
}

4
libraries/AP_Filesystem/AP_Filesystem_FATFS.h

@ -20,6 +20,10 @@ @@ -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;
};

Loading…
Cancel
Save