use longest_filename() for SD card files instead of longFilename

The long filename is not always filled, so files like "test.gco" may not
be shown in the file list. Use the built-in fallback to the longest name
available to overcome that issue and print the 8.3 name if no other is
available.
This commit is contained in:
Stefan Kalscheuer
2022-12-20 09:03:22 +01:00
parent 3be0c7e7a6
commit 3a19d9ef69

View File

@@ -1190,7 +1190,9 @@
else {
card.selectFileByIndex(count - 1);
int fileNameLen = strlen(card.longFilename);
// THe longname may not be filed, so we use the built-in fallback here.
char* fileName = card.longest_filename();
int fileNameLen = strlen(fileName);
bool fileNameWasCut = false;
// Cut off too long filenames.
@@ -1211,7 +1213,7 @@
outputString[i] = ' ';
}
else {
outputString[i] = card.longFilename[i];
outputString[i] = fileName[i];
if (!isPrintable(outputString[i]))
outputString[i] = '_';
}