From 3a19d9ef690b43b5919f35ac55e7e329ea934c22 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Tue, 20 Dec 2022 09:03:22 +0100 Subject: [PATCH] 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. --- Marlin/src/lcd/anycubic_touchscreen.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/lcd/anycubic_touchscreen.cpp b/Marlin/src/lcd/anycubic_touchscreen.cpp index ed957b1f..cb2f6e10 100755 --- a/Marlin/src/lcd/anycubic_touchscreen.cpp +++ b/Marlin/src/lcd/anycubic_touchscreen.cpp @@ -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] = '_'; } -- 2.25.1