mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Revising SD library API.
Open now returns a file object (which has a close() method); exists() no longer accepts a parent directory.
This commit is contained in:
@ -327,7 +327,7 @@ void SDClass::begin(uint8_t csPin) {
|
||||
}
|
||||
|
||||
|
||||
boolean SDClass::open(char *filepath,
|
||||
File SDClass::open(char *filepath,
|
||||
boolean write, boolean append) {
|
||||
/*
|
||||
|
||||
@ -368,19 +368,19 @@ boolean SDClass::open(char *filepath,
|
||||
fileOpenMode = oflag;
|
||||
walkPath(filepath, root, callback_openPath, this);
|
||||
|
||||
// TODO: Actually return something useful.
|
||||
return File();
|
||||
|
||||
}
|
||||
|
||||
|
||||
boolean SDClass::close() {
|
||||
/*
|
||||
|
||||
Closes the file opened by the `open` method.
|
||||
|
||||
*/
|
||||
file.close();
|
||||
}
|
||||
//boolean SDClass::close() {
|
||||
// /*
|
||||
//
|
||||
// Closes the file opened by the `open` method.
|
||||
//
|
||||
// */
|
||||
// file.close();
|
||||
//}
|
||||
|
||||
|
||||
boolean SDClass::exists(char *filepath) {
|
||||
@ -389,19 +389,19 @@ boolean SDClass::exists(char *filepath) {
|
||||
Returns true if the supplied file path exists.
|
||||
|
||||
*/
|
||||
return exists(filepath, root);
|
||||
return walkPath(filepath, root, callback_pathExists);
|
||||
}
|
||||
|
||||
|
||||
boolean SDClass::exists(char *filepath, SdFile& parentDir) {
|
||||
/*
|
||||
|
||||
Returns true if the supplied file path rooted at `parentDir`
|
||||
exists.
|
||||
|
||||
*/
|
||||
return walkPath(filepath, parentDir, callback_pathExists);
|
||||
}
|
||||
//boolean SDClass::exists(char *filepath, SdFile& parentDir) {
|
||||
// /*
|
||||
//
|
||||
// Returns true if the supplied file path rooted at `parentDir`
|
||||
// exists.
|
||||
//
|
||||
// */
|
||||
// return walkPath(filepath, parentDir, callback_pathExists);
|
||||
//}
|
||||
|
||||
|
||||
boolean SDClass::makeDir(char *filepath) {
|
||||
|
Reference in New Issue
Block a user