Browse Source

Skip redundant file/dir tests

vanilla_fb_2.0.x
Scott Lahteine 5 years ago
parent
commit
d34c22ac22
  1. 11
      Marlin/src/sd/cardreader.cpp

11
Marlin/src/sd/cardreader.cpp

@ -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…
Cancel
Save