|
|
|
@ -629,7 +629,7 @@ void CardReader::getfilename(uint16_t nr, const char * const match/*=nullptr*/)
|
|
|
|
|
lsDive(nullptr, workDir, match);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint16_t CardReader::getnrfilenames() {
|
|
|
|
|
uint16_t CardReader::countFilesInWorkDir() {
|
|
|
|
|
lsAction = LS_Count;
|
|
|
|
|
nrFiles = 0;
|
|
|
|
|
workDir.rewind();
|
|
|
|
@ -707,6 +707,7 @@ void CardReader::chdir(const char * relpath) {
|
|
|
|
|
|
|
|
|
|
if (newDir.open(parent, relpath, O_READ)) {
|
|
|
|
|
workDir = newDir;
|
|
|
|
|
flag.workDirIsRoot = false;
|
|
|
|
|
if (workDirDepth < MAX_DIR_DEPTH)
|
|
|
|
|
workDirParents[workDirDepth++] = workDir;
|
|
|
|
|
#if ENABLED(SDCARD_SORT_ALPHA)
|
|
|
|
@ -726,14 +727,13 @@ int8_t CardReader::updir() {
|
|
|
|
|
presort();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
if (!workDirDepth) flag.workDirIsRoot = true;
|
|
|
|
|
return workDirDepth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CardReader::setroot() {
|
|
|
|
|
/*if (!workDir.openRoot(&volume)) {
|
|
|
|
|
SERIAL_ECHOLNPGM(MSG_SD_WORKDIR_FAIL);
|
|
|
|
|
}*/
|
|
|
|
|
workDir = root;
|
|
|
|
|
flag.workDirIsRoot = true;
|
|
|
|
|
#if ENABLED(SDCARD_SORT_ALPHA)
|
|
|
|
|
presort();
|
|
|
|
|
#endif
|
|
|
|
@ -801,7 +801,7 @@ void CardReader::setroot() {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// If there are files, sort up to the limit
|
|
|
|
|
uint16_t fileCnt = getnrfilenames();
|
|
|
|
|
uint16_t fileCnt = countFilesInWorkDir();
|
|
|
|
|
if (fileCnt > 0) {
|
|
|
|
|
|
|
|
|
|
// Never sort more than the max allowed
|
|
|
|
@ -981,7 +981,7 @@ uint16_t CardReader::get_num_Files() {
|
|
|
|
|
#if ENABLED(SDCARD_SORT_ALPHA) && SDSORT_USES_RAM && SDSORT_CACHE_NAMES
|
|
|
|
|
nrFiles // no need to access the SD card for filenames
|
|
|
|
|
#else
|
|
|
|
|
getnrfilenames()
|
|
|
|
|
countFilesInWorkDir()
|
|
|
|
|
#endif
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|