Fixed Issue #32: Confusing similar name files.

This commit is contained in:
Stephen White 2018-07-02 18:55:54 +10:00
parent e4dc6e54ec
commit d2b87e609a
1 changed files with 17 additions and 14 deletions

View File

@ -1466,6 +1466,8 @@ bool IEC_Commands::FindFirst(DIR& dir, const char* matchstr, FILINFO& filInfo)
// SOMELONGDISKIMAGENAME.D64 to SOMELONGDISKIMAGENAME*.D64 // SOMELONGDISKIMAGENAME.D64 to SOMELONGDISKIMAGENAME*.D64
// so the actual SOMELONGDISKIMAGENAMETHATISWAYTOOLONGFORCBMFILEBROWSERTODISPLAY.D64 will be found. // so the actual SOMELONGDISKIMAGENAMETHATISWAYTOOLONGFORCBMFILEBROWSERTODISPLAY.D64 will be found.
strcpy(pattern, matchstr); strcpy(pattern, matchstr);
if (strlen(pattern) > 12)
{
char* ext = strrchr(matchstr, '.'); char* ext = strrchr(matchstr, '.');
if (ext) if (ext)
{ {
@ -1484,6 +1486,7 @@ bool IEC_Commands::FindFirst(DIR& dir, const char* matchstr, FILINFO& filInfo)
if (len >= CBM_NAME_LENGTH) if (len >= CBM_NAME_LENGTH)
pattern[CBM_NAME_LENGTH - 1] = '*'; pattern[CBM_NAME_LENGTH - 1] = '*';
} }
}
//DEBUG_LOG("Pattern %s -> %s\r\n", matchstr, pattern); //DEBUG_LOG("Pattern %s -> %s\r\n", matchstr, pattern);
res = f_findfirst(&dir, &filInfo, ".", (const TCHAR*)pattern); res = f_findfirst(&dir, &filInfo, ".", (const TCHAR*)pattern);
//DEBUG_LOG("found file %s\r\n", filInfo.fname); //DEBUG_LOG("found file %s\r\n", filInfo.fname);