Skip to content

Commit 40c9126

Browse files
committed
Remove unuse function printDirectory
1 parent 2dd14e9 commit 40c9126

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

libraries/WebServer/examples/UploadHugeFile/UploadHugeFile.ino

-44
Original file line numberDiff line numberDiff line change
@@ -42,50 +42,6 @@ void returnFail(String msg) {
4242
server.send(500, "text/plain", msg + "\r\n");
4343
}
4444

45-
void printDirectory() {
46-
if (!server.hasArg("dir")) {
47-
return returnFail("BAD ARGS");
48-
}
49-
String path = server.arg("dir");
50-
if (path != "/" && !SD.exists((char *)path.c_str())) {
51-
return returnFail("BAD PATH");
52-
}
53-
File dir = SD.open((char *)path.c_str());
54-
path = String();
55-
if (!dir.isDirectory()) {
56-
dir.close();
57-
return returnFail("NOT DIR");
58-
}
59-
dir.rewindDirectory();
60-
server.setContentLength(CONTENT_LENGTH_UNKNOWN);
61-
server.send(200, "text/json", "");
62-
WiFiClient client = server.client();
63-
64-
server.sendContent("[");
65-
for (int cnt = 0; true; ++cnt) {
66-
File entry = dir.openNextFile();
67-
if (!entry) {
68-
break;
69-
}
70-
71-
String output;
72-
if (cnt > 0) {
73-
output = ',';
74-
}
75-
76-
output += "{\"type\":\"";
77-
output += (entry.isDirectory()) ? "dir" : "file";
78-
output += "\",\"name\":\"";
79-
output += entry.path();
80-
output += "\"";
81-
output += "}";
82-
server.sendContent(output);
83-
entry.close();
84-
}
85-
server.sendContent("]");
86-
dir.close();
87-
}
88-
8945
void handleNotFound() {
9046
String message = "File Not Found\n\n";
9147
message += "URI: ";

0 commit comments

Comments
 (0)