Skip to content

Commit

Permalink
additional intention corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
hasenradball committed Nov 18, 2024
1 parent 300af91 commit dca0893
Showing 1 changed file with 21 additions and 21 deletions.
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 listDirectory() {
}


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 @@ void printDirectoryName(const char* name, uint8_t level) {

// 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 || !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

0 comments on commit dca0893

Please sign in to comment.