diff --git a/src/fsfw/cfdp/handler/DestHandler.cpp b/src/fsfw/cfdp/handler/DestHandler.cpp index d9c8793d..d7fdafe6 100644 --- a/src/fsfw/cfdp/handler/DestHandler.cpp +++ b/src/fsfw/cfdp/handler/DestHandler.cpp @@ -310,7 +310,9 @@ ReturnValue_t cfdp::DestHandler::startTransaction(const MetadataPduReader& reade FilesystemParams fparams(transactionParams.destName.data()); // handling to allow only specifying target directory. Example: // Source path /test/hello.txt, dest path /tmp -> dest path /tmp/hello.txt - if (destParams.user.vfs.isDirectory(transactionParams.destName.data())) { + bool isDirectory = false; + result = destParams.user.vfs.isDirectory(transactionParams.destName.data(), isDirectory); + if (result == returnvalue::OK && isDirectory) { result = tryBuildingAbsoluteDestName(destNameSize); if (result != OK) { return result; diff --git a/src/fsfw/filesystem/HasFileSystemIF.h b/src/fsfw/filesystem/HasFileSystemIF.h index bffc174d..ad9a583d 100644 --- a/src/fsfw/filesystem/HasFileSystemIF.h +++ b/src/fsfw/filesystem/HasFileSystemIF.h @@ -58,11 +58,7 @@ class HasFileSystemIF { static constexpr ReturnValue_t DIRECTORY_ALREADY_EXISTS = MAKE_RETURN_CODE(22); static constexpr ReturnValue_t NOT_A_DIRECTORY = MAKE_RETURN_CODE(23); static constexpr ReturnValue_t DIRECTORY_NOT_EMPTY = MAKE_RETURN_CODE(24); - - //! [EXPORT] : P1: Sequence number missing - static constexpr ReturnValue_t SEQUENCE_PACKET_MISSING_WRITE = MAKE_RETURN_CODE(30); - //! [EXPORT] : P1: Sequence number missing - static constexpr ReturnValue_t SEQUENCE_PACKET_MISSING_READ = MAKE_RETURN_CODE(31); + static constexpr ReturnValue_t ELEMENT_DOES_NOT_EXIST = MAKE_RETURN_CODE(25); virtual ~HasFileSystemIF() = default; @@ -78,7 +74,7 @@ class HasFileSystemIF { virtual ReturnValue_t getBaseFilename(FilesystemParams params, char* nameBuf, size_t maxLen, size_t& baseNameLen) = 0; - virtual bool isDirectory(const char* path) = 0; + virtual ReturnValue_t isDirectory(const char* path, bool& isDirectory) = 0; virtual ReturnValue_t getFileSize(FilesystemParams params, uint64_t& fileSize) = 0; diff --git a/src/fsfw_hal/host/HostFilesystem.cpp b/src/fsfw_hal/host/HostFilesystem.cpp index 827dda3d..f8739fb8 100644 --- a/src/fsfw_hal/host/HostFilesystem.cpp +++ b/src/fsfw_hal/host/HostFilesystem.cpp @@ -170,7 +170,10 @@ ReturnValue_t HostFilesystem::truncateFile(FilesystemParams params) { return returnvalue::OK; } -bool HostFilesystem::isDirectory(const char *path) { return filesystem::is_directory(path); } +ReturnValue_t HostFilesystem::isDirectory(const char *path, bool &isDirectory) { + isDirectory = filesystem::is_directory(path); + return returnvalue::OK; +} ReturnValue_t HostFilesystem::getBaseFilename(FilesystemParams params, char *nameBuf, size_t maxLen, size_t &baseNameLen) { diff --git a/src/fsfw_hal/host/HostFilesystem.h b/src/fsfw_hal/host/HostFilesystem.h index 5b029abd..5c5f8919 100644 --- a/src/fsfw_hal/host/HostFilesystem.h +++ b/src/fsfw_hal/host/HostFilesystem.h @@ -12,7 +12,7 @@ class HostFilesystem : public HasFileSystemIF { ReturnValue_t getBaseFilename(FilesystemParams params, char *nameBuf, size_t maxLen, size_t &baseNameLen) override; virtual ReturnValue_t getFileSize(FilesystemParams params, uint64_t &fileSize) override; - bool isDirectory(const char *path) override; + ReturnValue_t isDirectory(const char *path, bool &isDirectory) override; bool fileExists(FilesystemParams params) override; ReturnValue_t truncateFile(FilesystemParams params) override; ReturnValue_t writeToFile(FileOpParams params, const uint8_t *data) override;