Skip redundant file/dir tests

This commit is contained in:
Scott Lahteine 2020-04-13 17:22:43 -05:00
parent c3946dd017
commit d34c22ac22

View File

@ -154,12 +154,13 @@ char *createFilename(char * const buffer, const dir_t &p) {
// Return 'true' if the item is a folder or G-code file // Return 'true' if the item is a folder or G-code file
// //
bool CardReader::is_dir_or_gcode(const dir_t &p) { bool CardReader::is_dir_or_gcode(const dir_t &p) {
uint8_t pn0 = p.name[0]; //uint8_t pn0 = p.name[0];
if ( pn0 == DIR_NAME_FREE || pn0 == DIR_NAME_DELETED // Clear or Deleted entry if ( (p.attributes & DIR_ATT_HIDDEN) // Hidden by attribute
|| pn0 == '.' || longFilename[0] == '.' // Hidden file // When readDir() > 0 these must be false:
|| !DIR_IS_FILE_OR_SUBDIR(&p) // Not a File or Directory //|| pn0 == DIR_NAME_FREE || pn0 == DIR_NAME_DELETED // Clear or Deleted entry
|| (p.attributes & DIR_ATT_HIDDEN) // Hidden by attribute //|| pn0 == '.' || longFilename[0] == '.' // Hidden file
//|| !DIR_IS_FILE_OR_SUBDIR(&p) // Not a File or Directory
) return false; ) return false;
flag.filenameIsDir = DIR_IS_SUBDIR(&p); // We know it's a File or Folder flag.filenameIsDir = DIR_IS_SUBDIR(&p); // We know it's a File or Folder