Skip to content

Commit

Permalink
Ensure stat works for root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Apr 23, 2021
1 parent 00dbf84 commit dd48d08
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sming/Libraries/LittleFS
Submodule LittleFS updated 1 files
+41 −28 src/FileSystem.cpp
9 changes: 9 additions & 0 deletions Sming/Libraries/Spiffs/src/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,15 @@ int FileSystem::stat(const char* path, Stat* stat)
{
CHECK_MOUNTED()

if(isRootPath(path)) {
if(stat != nullptr) {
*stat = Stat{};
stat->fs = this;
stat->attr += FileAttribute::Directory;
}
return FS_OK;
}

spiffs_stat ss;
int err = SPIFFS_stat(handle(), path ?: "", &ss);
if(err < 0) {
Expand Down

0 comments on commit dd48d08

Please sign in to comment.