continued host FS test
This commit is contained in:
@ -16,9 +16,18 @@ struct FilesystemParams {
|
||||
FileSystemArgsIF* args = nullptr;
|
||||
};
|
||||
|
||||
struct FileOpParams : public FilesystemParams {
|
||||
FileOpParams(const char* path, size_t size) : FilesystemParams(path), size(size) {}
|
||||
struct FileOpParams {
|
||||
FileOpParams(const char* path, size_t size) : fsParams(path), size(size) {}
|
||||
|
||||
[[nodiscard]] const char* path() const {
|
||||
return fsParams.path;
|
||||
}
|
||||
|
||||
[[nodiscard]] FileSystemArgsIF* args() const {
|
||||
return fsParams.args;
|
||||
}
|
||||
|
||||
FilesystemParams fsParams;
|
||||
size_t size;
|
||||
size_t offset = 0;
|
||||
};
|
||||
|
@ -11,10 +11,10 @@ using namespace std;
|
||||
HostFilesystem::HostFilesystem() = default;
|
||||
|
||||
ReturnValue_t HostFilesystem::writeToFile(FileOpParams params, const uint8_t *data) {
|
||||
if (params.path == nullptr) {
|
||||
if (params.path() == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
path path(params.path);
|
||||
path path(params.path());
|
||||
if (not exists(path)) {
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
}
|
||||
@ -29,10 +29,10 @@ ReturnValue_t HostFilesystem::writeToFile(FileOpParams params, const uint8_t *da
|
||||
|
||||
ReturnValue_t HostFilesystem::readFromFile(FileOpParams params, uint8_t **buffer, size_t &readSize,
|
||||
size_t maxSize) {
|
||||
if (params.path == nullptr) {
|
||||
if (params.path() == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
path path(params.path);
|
||||
path path(params.path());
|
||||
if (not exists(path)) {
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
}
|
||||
|
Reference in New Issue
Block a user