FS: copy lfs_info and implement FS::Stat()
Implement the subset of the functionality to be usable to check if the file exists or not and check the size of the file.
This commit is contained in:
@@ -163,6 +163,16 @@ int FS::DirDelete(const char* path) {
|
||||
//return LFS_ERR_OK;
|
||||
}
|
||||
|
||||
// check if file exists, if so write file-size into info object
|
||||
int FS::Stat(const char* path, lfs_info* info) {
|
||||
if (!std::filesystem::exists(path))
|
||||
{
|
||||
return LFS_ERR_NOENT; // No directory entry
|
||||
}
|
||||
info->size = std::filesystem::file_size(path);
|
||||
return LFS_ERR_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
----------- Interface between littlefs and SpiNorFlash -----------
|
||||
|
Reference in New Issue
Block a user