6#define MAX_FILE_LEN 256
7#define MAX_FILE_COUNT 1000000
21template <
class SDT,
class FileT>
26 void begin(
const char *startDir,
const char *extension,
30 this->
ext = extension;
45 if (!
found)
return nullptr;
72 const char *
ext =
nullptr;
77 if (dirname ==
nullptr)
return;
78 LOGD(
"listDir: %s", dirname);
79 FileT root =
open(dirname);
81 LOGE(
"Open failed: %s", dirname);
86 LOGD(
"Is not directory: %s", dirname);
90 if (
StrView(dirname).startsWith(
".")) {
91 LOGD(
"Invalid file: %s", dirname);
100 while (file && !
found) {
103 LOGD(
"name: %s", name.c_str());
117 LOGD(
"Ignoring %s", fn);
153 if (!
result.openNext(&dir, O_READ)) {
154 LOGD(
"No next file");
158 return dir.openNextFile();
164 LOGD(
"pushPath: %s", name);
165 String nameStr(name);
173 LOGD(
"popPath: %s", str.c_str());
178 const char *file_name =
fileName(file);
179 if (file.isDirectory()) {
180 LOGD(
"-> isValidAudioFile: '%s': %d", file_name,
false);
183 StrView strFileTName(file_name);
186 LOGD(
"-> isValidAudioFile: '%s': %d", file_name,
result);
204 return file.name() + pos;
210#if defined(USE_SDFAT) || ESP_IDF_VERSION_MAJOR >= 4
244 if (name !=
nullptr) {
245 LOGE(
"File open error: %s", name);
247 LOGE(
"File open error: name is null");
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define MAX_FILE_COUNT
Definition SDDirect.h:7
#define MAX_FILE_LEN
Definition SDDirect.h:6
#define FILE_READ
Definition VFSFile.h:17