@@ -79,7 +79,7 @@ IF_DISABLED(NO_SD_AUTOSTART, uint8_t CardReader::autofile_index); // = 0
79
79
80
80
// private:
81
81
82
- SdFile CardReader::root, CardReader::workDir, CardReader::workDirParents[MAX_DIR_DEPTH];
82
+ MediaFile CardReader::root, CardReader::workDir, CardReader::workDirParents[MAX_DIR_DEPTH];
83
83
uint8_t CardReader::workDirDepth;
84
84
85
85
#if ENABLED(SDCARD_SORT_ALPHA)
@@ -133,8 +133,8 @@ uint8_t CardReader::workDirDepth;
133
133
#endif
134
134
135
135
DiskIODriver* CardReader::driver = nullptr ;
136
- SdVolume CardReader::volume;
137
- SdFile CardReader::file;
136
+ MarlinVolume CardReader::volume;
137
+ MediaFile CardReader::file;
138
138
139
139
#if HAS_MEDIA_SUBCALLS
140
140
uint8_t CardReader::file_subcall_ctr;
@@ -228,7 +228,7 @@ bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD,
228
228
//
229
229
// Get the number of (compliant) items in the folder
230
230
//
231
- int CardReader::countItems (SdFile dir) {
231
+ int CardReader::countItems (MediaFile dir) {
232
232
dir_t p;
233
233
int c = 0 ;
234
234
while (dir.readDir (&p, longFilename) > 0 )
@@ -244,7 +244,7 @@ int CardReader::countItems(SdFile dir) {
244
244
//
245
245
// Get file/folder info for an item by index
246
246
//
247
- void CardReader::selectByIndex (SdFile dir, const uint8_t index) {
247
+ void CardReader::selectByIndex (MediaFile dir, const uint8_t index) {
248
248
dir_t p;
249
249
for (uint8_t cnt = 0 ; dir.readDir (&p, longFilename) > 0 ;) {
250
250
if (is_visible_entity (p)) {
@@ -260,7 +260,7 @@ void CardReader::selectByIndex(SdFile dir, const uint8_t index) {
260
260
//
261
261
// Get file/folder info for an item by name
262
262
//
263
- void CardReader::selectByName (SdFile dir, const char * const match) {
263
+ void CardReader::selectByName (MediaFile dir, const char * const match) {
264
264
dir_t p;
265
265
for (uint8_t cnt = 0 ; dir.readDir (&p, longFilename) > 0 ; cnt++) {
266
266
if (is_visible_entity (p)) {
@@ -280,7 +280,7 @@ void CardReader::selectByName(SdFile dir, const char * const match) {
280
280
* this can blow up the stack, so a 'depth' parameter would be a
281
281
* good addition.
282
282
*/
283
- void CardReader::printListing (SdFile parent, const char * const prepend, const uint8_t lsflags
283
+ void CardReader::printListing (MediaFile parent, const char * const prepend, const uint8_t lsflags
284
284
OPTARG (LONG_FILENAME_HOST_SUPPORT, const char * const prependLong/* =nullptr*/ )
285
285
) {
286
286
const bool includeTime = TERN0 (M20_TIMESTAMP_SUPPORT, TEST (lsflags, LS_TIMESTAMP));
@@ -304,7 +304,7 @@ void CardReader::printListing(SdFile parent, const char * const prepend, const
304
304
305
305
// Get a new directory object using the full path
306
306
// and dive recursively into it.
307
- SdFile child; // child.close() in destructor
307
+ MediaFile child; // child.close() in destructor
308
308
if (child.open (&parent, dosFilename, O_READ)) {
309
309
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
310
310
if (includeLong) {
@@ -375,7 +375,7 @@ void CardReader::ls(const uint8_t lsflags) {
375
375
// Zero out slashes to make segments
376
376
for (i = 0 ; i < pathLen; i++) if (path[i] == ' /' ) path[i] = ' \0 ' ;
377
377
378
- SdFile diveDir = root; // start from the root for segment 1
378
+ MediaFile diveDir = root; // start from the root for segment 1
379
379
for (i = 0 ; i < pathLen;) {
380
380
381
381
if (path[i] == ' \0 ' ) i++; // move past a single nul
@@ -404,7 +404,7 @@ void CardReader::ls(const uint8_t lsflags) {
404
404
// SERIAL_ECHOPGM("Opening dir: "); SERIAL_ECHOLN(segment);
405
405
406
406
// Open the sub-item as the new dive parent
407
- SdFile dir;
407
+ MediaFile dir;
408
408
if (!dir.open (&diveDir, segment, O_READ)) {
409
409
SERIAL_EOL ();
410
410
SERIAL_ECHO_START ();
@@ -604,7 +604,7 @@ void CardReader::getAbsFilenameInCWD(char *dst) {
604
604
*dst++ = ' /' ;
605
605
uint8_t cnt = 1 ;
606
606
607
- auto appendAtom = [&](SdFile &file) {
607
+ auto appendAtom = [&](MediaFile &file) {
608
608
file.getDosName (dst);
609
609
while (*dst && cnt < MAXPATHNAMELENGTH) { dst++; cnt++; }
610
610
if (cnt < MAXPATHNAMELENGTH) { *dst = ' /' ; dst++; cnt++; }
@@ -683,7 +683,7 @@ void CardReader::openFileRead(const char * const path, const uint8_t subcall_typ
683
683
684
684
abortFilePrintNow ();
685
685
686
- SdFile *diveDir;
686
+ MediaFile *diveDir;
687
687
const char * const fname = diveToFile (true , diveDir, path);
688
688
if (!fname) return openFailed (path);
689
689
@@ -719,7 +719,7 @@ void CardReader::openFileWrite(const char * const path) {
719
719
720
720
abortFilePrintNow ();
721
721
722
- SdFile *diveDir;
722
+ MediaFile *diveDir;
723
723
const char * const fname = diveToFile (false , diveDir, path);
724
724
if (!fname) return openFailed (path);
725
725
@@ -747,7 +747,7 @@ bool CardReader::fileExists(const char * const path) {
747
747
DEBUG_ECHOLNPGM (" fileExists: " , path);
748
748
749
749
// Dive to the file's directory and get the base name
750
- SdFile *diveDir = nullptr ;
750
+ MediaFile *diveDir = nullptr ;
751
751
const char * const fname = diveToFile (false , diveDir, path);
752
752
if (!fname) return false ;
753
753
@@ -757,7 +757,7 @@ bool CardReader::fileExists(const char * const path) {
757
757
// diveDir->close();
758
758
759
759
// Try to open the file and return the result
760
- SdFile tmpFile;
760
+ MediaFile tmpFile;
761
761
const bool success = tmpFile.open (diveDir, fname, O_READ);
762
762
if (success) tmpFile.close ();
763
763
return success;
@@ -771,7 +771,7 @@ void CardReader::removeFile(const char * const name) {
771
771
772
772
// abortFilePrintNow();
773
773
774
- SdFile *itsDirPtr;
774
+ MediaFile *itsDirPtr;
775
775
const char * const fname = diveToFile (false , itsDirPtr, name);
776
776
if (!fname) return ;
777
777
@@ -919,23 +919,23 @@ uint16_t CardReader::countFilesInWorkDir() {
919
919
* - The workDir points to the last-set navigation target by cd, cdup, cdroot, or diveToFile(true, ...)
920
920
*
921
921
* On exit:
922
- * - Your curDir pointer contains an SdFile reference to the file's directory.
922
+ * - Your curDir pointer contains an MediaFile reference to the file's directory.
923
923
* - If update_cwd was 'true' the workDir now points to the file's directory.
924
924
*
925
925
* Returns a pointer to the last segment (filename) of the given DOS 8.3 path.
926
- * On exit, inDirPtr contains an SdFile reference to the file's directory.
926
+ * On exit, inDirPtr contains an MediaFile reference to the file's directory.
927
927
*
928
928
* A nullptr result indicates an unrecoverable error.
929
929
*
930
930
* NOTE: End the path with a slash to dive to a folder. In this case the
931
931
* returned filename will be blank (points to the end of the path).
932
932
*/
933
- const char * CardReader::diveToFile (const bool update_cwd, SdFile * &inDirPtr, const char * const path, const bool echo/* =false*/ ) {
933
+ const char * CardReader::diveToFile (const bool update_cwd, MediaFile * &inDirPtr, const char * const path, const bool echo/* =false*/ ) {
934
934
DEBUG_SECTION (est, " diveToFile" , true );
935
935
936
936
// Track both parent and subfolder
937
- static SdFile newDir1, newDir2;
938
- SdFile *sub = &newDir1, *startDirPtr;
937
+ static MediaFile newDir1, newDir2;
938
+ MediaFile *sub = &newDir1, *startDirPtr;
939
939
940
940
// Parsing the path string
941
941
const char *atom_ptr = path;
@@ -1017,7 +1017,7 @@ const char* CardReader::diveToFile(const bool update_cwd, SdFile* &inDirPtr, con
1017
1017
}
1018
1018
1019
1019
void CardReader::cd (const char * relpath) {
1020
- SdFile newDir, *parent = &getWorkDir ();
1020
+ MediaFile newDir, *parent = &getWorkDir ();
1021
1021
1022
1022
if (newDir.open (parent, relpath, O_READ)) {
1023
1023
workDir = newDir;
0 commit comments