10000 SD - examples/listfilesEnhanced by hasenradball · Pull Request #9206 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

SD - examples/listfilesEnhanced #9206

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

Merged
merged 11 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
additional intention corrections
  • Loading branch information
hasenradball committed Nov 18, 2024
commit dca0893db75f1cdc9b5dda886abda4043073562e
42 changes: 21 additions & 21 deletions libraries/SD/examples/listFilesEnhanced/listfilesEnhanced.ino
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}


void printDirectoryName(const char* name, uint8_t level) {
void printDirectoryName(const char *name, uint8_t level) {
for (uint8_t i = 0; i < level; ++i) {
Serial.print(" ");
}
Expand All @@ -75,30 +75,30 @@

// helper function: combine path
String joinPath(const String &base, const String &name) {
if (base.endsWith("/")) {
return base + name;
}
return base + "/" + name;
if (base.endsWith("/")) {
return base + name;
}
return base + "/" + name;
}

// recusive function to collect directory names
void collectDirectories(const String &dirname, std::vector<String> &directories) {
File root = SD.open(dirname);
if (!root || ! B318 root.isDirectory()) {
Serial.printf("Error: Verzeichnis %s konnte nicht geöffnet werden\n", dirname.c_str());
return;
}
directories.push_back(dirname); // Verzeichnis speichern

File file = root.openNextFile();
while (file) {
if (file.isDirectory()) {
String fullPath = joinPath(dirname, file.name()); // Vollständigen Pfad erstellen
collectDirectories(fullPath, directories); // Rekursiver Aufruf
}
file = root.openNextFile();
}
root.close();
File root = SD.open(dirname);
if (!root || !root.isDirectory()) {
Serial.printf("Error: Verzeichnis %s konnte nicht geöffnet werden\n", dirname.c_str());

Check failure on line 88 in libraries/SD/examples/listFilesEnhanced/listfilesEnhanced.ino

View workflow job for this annotation

GitHub Actions / clang-format

Run tests/restyle.sh and re-commit libraries/SD/examples/listFilesEnhanced/listfilesEnhanced.ino

File libraries/SD/examples/listFilesEnhanced/listfilesEnhanced.ino failed clang-format style check. (lines 88)
return;
}
directories.push_back(dirname); // Verzeichnis speichern

File file = root.openNextFile();
while (file) {
if (file.isDirectory()) {
String fullPath = joinPath(dirname, file.name()); // Vollständigen Pfad erstellen
collectDirectories(fullPath, directories); // Rekursiver Aufruf
}
file = root.openNextFile();
}
root.close();
}

// print filenames
Expand Down
Loading
0