MCPcopy Create free account
hub / github.com/BruceDevices/firmware / checkExt

Function checkExt

src/core/sd_functions.cpp:491–509  ·  view source on GitHub ↗

** Function name: checkExt ** Description: check file extension ***************************************************************************************/

Source from the content-addressed store, hash-verified

489** Description: check file extension
490***************************************************************************************/
491bool checkExt(String ext, String pattern) {
492 ext.toUpperCase();
493 pattern.toUpperCase();
494 if (ext == pattern) return true;
495
496 // If the pattern is a list of extensions (e.g., "TXT|JPG|PNG"), split and check
497 int start = 0;
498 int end = pattern.indexOf('|');
499 while (end != -1) {
500 String currentExt = pattern.substring(start, end);
501 if (ext == currentExt) { return true; }
502 start = end + 1;
503 end = pattern.indexOf('|', start);
504 }
505
506 // Check the last extension in the list
507 String lastExt = pattern.substring(start);
508 return ext == lastExt;
509}
510
511/***************************************************************************************
512** Function name: readFs

Callers 1

readFsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected