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

Speed up listing files in large directory, README.adoc typo fixed #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/
The SD library allows for reading from and writing to SD cards.

For more information about this library please visit us at
http://www.arduino.cc/en/Reference/repository-name}
http://www.arduino.cc/en/Reference/{repository-name}
11 changes: 6 additions & 5 deletions src/SD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ namespace SDLib {

//Serial.print("\t\treading dir...");
while (_file->readDir(&p) > 0) {

// done if past last used entry
if (p.name[0] == DIR_NAME_FREE) {
//Serial.println("end");
Expand All @@ -607,14 +606,16 @@ namespace SDLib {
}

// print file name with possible blank fill
SdFile f;
char name[13];
_file->dirName(p, name);
//Serial.print("try to open file ");
//Serial.println(name);

if (f.open(_file, name, mode)) {
SdFile f;
uint16_t index = (_file->curPosition() - sizeof(dir_t) ) >> 5;

if (f.open(_file, index, mode)) {
//Serial.println("OK!");
char name[13];
_file->dirName(p, name);
return File(f, name);
} else {
//Serial.println("ugh");
Expand Down