MCPcopy Create free account
hub / github.com/SmingHub/Sming / printDirectory

Function printDirectory

samples/Basic_IFS/app/application.cpp:315–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315void printDirectory(const char* path)
316{
317 auto printStream = [](IDataSourceStream& stream) {
318 // Use an intermediate memory stream so debug information doesn't get mixed into output
319 // MemoryDataStream mem;
320 // mem.copyFrom(&stream);
321 // Serial.copyFrom(&mem);
322 Serial.copyFrom(&stream);
323 };
324
325 {
326 auto dir = new Directory;
327 if(!dir->open(path)) {
328 debug_e("Open '%s' failed: %s", path, dir->getLastErrorString().c_str());
329 delete dir;
330 return;
331 }
332
333 auto source = new FlashMemoryStream(listing_txt);
334 IFS::DirectoryTemplate tmpl(source, dir);
335 printStream(tmpl);
336 }
337
338 {
339 auto dir = new Directory;
340 if(!dir->open(path)) {
341 debug_e("Open '%s' failed: %s", path, dir->getLastErrorString().c_str());
342 delete dir;
343 return;
344 }
345
346 auto source = new FlashMemoryStream(listing_json);
347 IFS::JsonDirectoryTemplate tmpl(source, dir);
348 printStream(tmpl);
349 }
350}
351
352void copySomeFiles()
353{

Callers 1

fstestFunction · 0.85

Calls 3

copyFromMethod · 0.45
openMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected