MCPcopy Create free account
hub / github.com/BruceDevices/firmware / createDirRecursive

Function createDirRecursive

src/core/wifi/webInterface.cpp:195–217  ·  view source on GitHub ↗

** Function: createDirRecursive ** Create folders recursivelly **********************************************************************/

Source from the content-addressed store, hash-verified

193** Create folders recursivelly
194**********************************************************************/
195void createDirRecursive(String path, FS fs) {
196 String currentPath = "";
197 int startIndex = 0;
198 // Serial.print("Verifying folder: ");
199 // Serial.println(path);
200
201 while (startIndex < path.length()) {
202 int endIndex = path.indexOf("/", startIndex);
203 if (endIndex == -1) endIndex = path.length();
204
205 currentPath += path.substring(startIndex, endIndex);
206 if (currentPath.length() > 0) {
207 if (!fs.exists(currentPath)) {
208 fs.mkdir(currentPath);
209 // Serial.print("Creating folder: ");
210 // Serial.println(currentPath);
211 }
212 }
213
214 if (endIndex < path.length()) { currentPath += "/"; }
215 startIndex = endIndex + 1;
216 }
217}
218/**********************************************************************
219** Function: handleUpload
220** handles uploads to the filserver

Callers 1

handleUploadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected