1
0
forked from fsfw/fsfw

additional filesystem abstractions

This commit is contained in:
2022-09-05 17:42:56 +02:00
parent 5a3f05fa79
commit 2e4cdb7366
9 changed files with 102 additions and 46 deletions

View File

@ -144,3 +144,17 @@ ReturnValue_t HostFilesystem::rename(const char *oldPath_, const char *newPath_,
}
return returnvalue::OK;
}
bool HostFilesystem::fileExists(FilesystemParams params) {
path path(params.path);
return filesystem::exists(path);
}
ReturnValue_t HostFilesystem::truncateFile(FilesystemParams params) {
path path(params.path);
if (not filesystem::exists(path)) {
return FILE_DOES_NOT_EXIST;
}
ofstream of(path);
return returnvalue::OK;
}

View File

@ -8,6 +8,9 @@
class HostFilesystem : public HasFileSystemIF {
public:
HostFilesystem();
bool fileExists(FilesystemParams params) override;
ReturnValue_t truncateFile(FilesystemParams params) override;
ReturnValue_t writeToFile(FileOpParams params, const uint8_t *data) override;
ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t **buffer, size_t &readSize,
size_t maxSize) override;