getFileSize API for fsfw
This commit is contained in:
@ -145,3 +145,13 @@ ReturnValue_t FilesystemMock::getBaseFilename(FilesystemParams params, char *nam
|
||||
}
|
||||
|
||||
bool FilesystemMock::isDirectory(const char *path) { return false; }
|
||||
|
||||
bool FilesystemMock::getFileSize(FilesystemParams params, size_t &fileSize) {
|
||||
std::string filename(params.path);
|
||||
auto iter = fileMap.find(filename);
|
||||
if (iter == fileMap.end()) {
|
||||
fileSize = iter->second.fileRaw.size();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ class FilesystemMock : public HasFileSystemIF {
|
||||
bool isDirectory(const char *path) override;
|
||||
bool fileExists(FilesystemParams params) override;
|
||||
ReturnValue_t truncateFile(FilesystemParams params) override;
|
||||
bool getFileSize(FilesystemParams params, size_t &fileSize) override;
|
||||
|
||||
ReturnValue_t writeToFile(FileOpParams params, const uint8_t *data) override;
|
||||
ReturnValue_t readFromFile(FileOpParams params, uint8_t **buffer, size_t &readSize,
|
||||
|
Reference in New Issue
Block a user