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

Method stat

Sming/Libraries/Spiffs/src/FileSystem.cpp:455–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455int FileSystem::stat(const char* path, Stat* stat)
456{
457 CHECK_MOUNTED()
458
459 if(isRootPath(path)) {
460 if(stat != nullptr) {
461 *stat = Stat{};
462 stat->fs = this;
463 stat->attr += FileAttribute::Directory;
464 }
465 return FS_OK;
466 }
467
468 spiffs_stat ss;
469 int err = SPIFFS_stat(handle(), path ?: "", &ss);
470 CHECK_RES(err)
471
472 if(stat != nullptr) {
473 *stat = Stat{};
474 stat->fs = this;
475 stat->name.copy(reinterpret_cast<const char*>(ss.name));
476 stat->size = ss.size;
477 stat->id = ss.obj_id;
478 SpiffsMetaBuffer smb;
479#ifdef SPIFFS_STORE_META
480 smb.assign(ss.meta);
481#else
482 smb.init();
483#endif
484 fillStat(*stat, smb);
485 checkStat(*stat);
486 }
487
488 return FS_OK;
489}
490
491int FileSystem::fstat(FileHandle file, Stat* stat)
492{

Callers 8

handleCommandFunction · 0.45
listSpiffsPartitionsFunction · 0.45
onFileFunction · 0.45
copySomeFilesFunction · 0.45
listAttributesFunction · 0.45
readCheckMethod · 0.45
drawFunction · 0.45
scanFunction · 0.45

Calls 4

fillStatFunction · 0.85
copyMethod · 0.45
assignMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected