improve filesystem API

This commit is contained in:
Robin Müller 2024-04-17 21:52:31 +02:00
parent 8c87dafd5d
commit a1b6e2ff89
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 5 additions and 5 deletions

View File

@ -80,7 +80,7 @@ class HasFileSystemIF {
virtual bool isDirectory(const char* path) = 0;
virtual bool getFileSize(FilesystemParams params, uint64_t& fileSize) = 0;
virtual ReturnValue_t getFileSize(FilesystemParams params, uint64_t& fileSize) = 0;
virtual bool fileExists(FilesystemParams params) = 0;

View File

@ -185,10 +185,10 @@ ReturnValue_t HostFilesystem::getBaseFilename(FilesystemParams params, char *nam
return returnvalue::OK;
}
bool HostFilesystem::getFileSize(FilesystemParams params, uint64_t &fileSize) {
ReturnValue_t HostFilesystem::getFileSize(FilesystemParams params, uint64_t &fileSize) {
if (!fileExists(params)) {
return false;
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
}
fileSize = std::filesystem::file_size(params.path);
return true;
return returnvalue::OK;
}

View File

@ -11,7 +11,7 @@ class HostFilesystem : public HasFileSystemIF {
ReturnValue_t getBaseFilename(FilesystemParams params, char *nameBuf, size_t maxLen,
size_t &baseNameLen) override;
virtual bool getFileSize(FilesystemParams params, uint64_t &fileSize) override;
virtual ReturnValue_t getFileSize(FilesystemParams params, uint64_t &fileSize) override;
bool isDirectory(const char *path) override;
bool fileExists(FilesystemParams params) override;
ReturnValue_t truncateFile(FilesystemParams params) override;