SD function not working in SdFat lib

Hello Folks

I'm checking the extension of a file using the function below.

Works brilliantly with the standard SD library, but always returns false when using sdFat.

Any hints please? Thanks!

bool isJpg(char* filename) {
  int8_t len = strlen(filename);
  //check file extension for ".jpg"
  if (strstr(strlwr(filename + (len - 4)), ".mid")) {return true;}else{return false;}
}

On closer inspection it is the entry.name() that isn't working in sdFat.
The library returns "use getName()"

if I replace entry.name with entry.getName() I get compliler error no matching function for call to 'File::getName()'

Here is the code I'm using to get the file name:

void checkForJpg(File dir, int numTabs) {

    File entry =  dir.openNextFile();
      if ( isJpg(entry.name()) ) {} // it's a jpg
      
}

Again works fine in SD library

Ok so I figured it out, you can’t just use File with the sdFat, sdFile solved it :slight_smile:

Hi britFrog,

SD card with TFT?