Skip to content

Commit dca0893

Browse files
committed
additional intention corrections
1 parent 300af91 commit dca0893

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

libraries/SD/examples/listFilesEnhanced/listfilesEnhanced.ino

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void listDirectory() {
6464
}
6565

6666

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

7676
// helper function: combine path
7777
String joinPath(const String &base, const String &name) {
78-
if (base.endsWith("/")) {
79-
return base + name;
80-
}
81-
return base + "/" + name;
78+
if (base.endsWith("/")) {
79+
return base + name;
80+
}
81+
return base + "/" + name;
8282
}
8383

8484
// recusive function to collect directory names
8585
void collectDirectories(const String &dirname, std::vector<String> &directories) {
86-
File root = SD.open(dirname);
87-
if (!root || !root.isDirectory()) {
88-
Serial.printf("Error: Verzeichnis %s konnte nicht geöffnet werden\n", dirname.c_str());
89-
return;
90-
}
91-
directories.push_back(dirname); // Verzeichnis speichern
92-
93-
File file = root.openNextFile();
94-
while (file) {
95-
if (file.isDirectory()) {
96-
String fullPath = joinPath(dirname, file.name()); // Vollständigen Pfad erstellen
97-
collectDirectories(fullPath, directories); // Rekursiver Aufruf
98-
}
99-
file = root.openNextFile();
100-
}
101-
root.close();
86+
File root = SD.open(dirname);
87+
if (!root || !root.isDirectory()) {
88+
Serial.printf("Error: Verzeichnis %s konnte nicht geöffnet werden\n", dirname.c_str());
89+
return;
90+
}
91+
directories.push_back(dirname); // Verzeichnis speichern
92+
93+
File file = root.openNextFile();
94+
while (file) {
95+
if (file.isDirectory()) {
96+
String fullPath = joinPath(dirname, file.name()); // Vollständigen Pfad erstellen
97+
collectDirectories(fullPath, directories); // Rekursiver Aufruf
98+
}
99+
file = root.openNextFile();
100+
}
101+
root.close();
102102
}
103103

104104
// print filenames

0 commit comments

Comments
 (0)