1
0
forked from fsfw/fsfw

basic host FS unittests

This commit is contained in:
2022-08-11 10:10:05 +02:00
parent e796e025b6
commit 8aaabc5d73
6 changed files with 51 additions and 7 deletions

View File

@ -132,6 +132,9 @@ class HasFileSystemIF {
* @return
*/
virtual ReturnValue_t createDirectory(FilesystemParams params, bool createParentDirs) = 0;
virtual ReturnValue_t createDirectory(FilesystemParams params) {
return createDirectory(params, false);
}
/**
* @brief Generic function to remove a directory
@ -143,10 +146,11 @@ class HasFileSystemIF {
return removeDirectory(params, false);
}
virtual ReturnValue_t renameFile(const char* oldPath, char* newPath) {
virtual ReturnValue_t rename(const char* oldPath, const char* newPath) {
return rename(oldPath, newPath, nullptr);
}
virtual ReturnValue_t rename(const char* oldPath, char* newPath, FileSystemArgsIF* args) = 0;
virtual ReturnValue_t rename(const char* oldPath, const char* newPath,
FileSystemArgsIF* args) = 0;
};
#endif /* FSFW_MEMORY_HASFILESYSTEMIF_H_ */

View File

@ -132,7 +132,8 @@ ReturnValue_t HostFilesystem::removeDirectory(FilesystemParams params, bool dele
return HasFileSystemIF::GENERIC_DIR_ERROR;
}
ReturnValue_t HostFilesystem::rename(const char *oldPath_, char *newPath_, FileSystemArgsIF *args) {
ReturnValue_t HostFilesystem::rename(const char *oldPath_, const char *newPath_,
FileSystemArgsIF *args) {
if (oldPath_ == nullptr or newPath_ == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -15,11 +15,15 @@ class HostFilesystem : public HasFileSystemIF {
ReturnValue_t removeFile(const char *path, FileSystemArgsIF *args) override;
ReturnValue_t createDirectory(FilesystemParams params, bool createParentDirs) override;
ReturnValue_t removeDirectory(FilesystemParams params, bool deleteRecurively) override;
ReturnValue_t rename(const char *oldPath, char *newPath, FileSystemArgsIF *args) override;
ReturnValue_t rename(const char *oldPath, const char *newPath, FileSystemArgsIF *args) override;
std::error_code errorCode;
using HasFileSystemIF::createDirectory;
using HasFileSystemIF::createFile;
using HasFileSystemIF::removeDirectory;
using HasFileSystemIF::removeFile;
using HasFileSystemIF::rename;
private:
};
#endif // FSFW_HAL_HOSTFILESYSTEM_H