Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SdFat32::chdir method changed? #222

Closed
MajicDesigns opened this issue Nov 22, 2020 · 2 comments
Closed

SdFat32::chdir method changed? #222

MajicDesigns opened this issue Nov 22, 2020 · 2 comments

Comments

@MajicDesigns
Copy link

Environment: Arduino Uno, Arduino IDE, Windows 10.

I use the SDFat library to to manage file I/O in my own library (https://github.com/MajicDesigns/MD_MIDIFile) .

Prior to this latest upgrade the code all compiled fine. After installing version 2, I (and other users of the MIDIFile library) get compile errors for the subject method. The relevant section of the compiler output is below:

MD_MIDIFile.h: In member function void MD_MIDIFile::setFileFolder(const char*) MD_MIDIFile.h: 899:87: error: no matching function for call to 'SdFat32::chdir(const char*&, bool) MD_MIDIFile.h: 899:87: error: no matching function for call to 'SdFat32::chdir(const char*&, bool) void setFileFolder(const char* apath) { if (apath != nullptr) _sd->chdir(apath, true); } void setFileFolder(const char* apath) { if (apath != nullptr) _sd->chdir(apath, true); }

Looking at the library html docs it would seem the method is still there, but the second parameter has been removed. If this is correct, what do I need to do to update my library to eliminate this problem and retain the same functionality?

@greiman
Copy link
Owner

greiman commented Nov 23, 2020

This function"
void setFileFolder(const char* apath) { if (apath != nullptr) _sd->chdir(apath, true); }

can be replaced by:
void setFileFolder(const char* apath) {if (apath != nullptr && _sd->chdir(apath)) _sd->chvol();}

I eliminated a number of functions where a bool argument just meant calling another function. Unless you have multiple SD cards there is no reason to ever call chvol. The second argument led to confusion.

@MajicDesigns
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants