Skip redundant file/dir tests
This commit is contained in:
parent
c3946dd017
commit
d34c22ac22
@ -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
|
||||
//
|
||||
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
|
||||
|| pn0 == '.' || longFilename[0] == '.' // Hidden file
|
||||
|| !DIR_IS_FILE_OR_SUBDIR(&p) // Not a File or Directory
|
||||
|| (p.attributes & DIR_ATT_HIDDEN) // Hidden by attribute
|
||||
if ( (p.attributes & DIR_ATT_HIDDEN) // Hidden by attribute
|
||||
// When readDir() > 0 these must be false:
|
||||
//|| pn0 == DIR_NAME_FREE || pn0 == DIR_NAME_DELETED // Clear or Deleted entry
|
||||
//|| pn0 == '.' || longFilename[0] == '.' // Hidden file
|
||||
//|| !DIR_IS_FILE_OR_SUBDIR(&p) // Not a File or Directory
|
||||
) return false;
|
||||
|
||||
flag.filenameIsDir = DIR_IS_SUBDIR(&p); // We know it's a File or Folder
|
||||
|
Loading…
Reference in New Issue
Block a user