21 return &this->m_handle;
28 if (mode == OpenMode::CREATE_EXCLUSIVE || mode == OpenMode::CREATE_IF_MISSING) {
29 if (::mkdir(path, S_IRWXU) == -1) {
34 if (status != Status::ALREADY_EXISTS || mode == OpenMode::CREATE_EXCLUSIVE) {
42 DIR* dir = ::opendir(path);
68 struct dirent* direntData =
nullptr;
69 while ((direntData = ::readdir(this->m_handle.
m_dir_descriptor)) !=
nullptr) {
71 if ((direntData->d_name[0] ==
'.' and direntData->d_name[1] ==
'\0') or
72 (direntData->d_name[0] ==
'.' and direntData->d_name[1] ==
'.' and direntData->d_name[2] ==
'\0')) {
79 if (direntData ==
nullptr) {
83 status = Status::BAD_DESCRIPTOR;
85 status = Status::NO_MORE_FILES;
PlatformSizeType FwSizeType
void close() override
Close directory.
DirectoryHandle * getHandle() override
return the underlying mutex handle (implementation specific)
Status rewind() override
Rewind directory stream.
Status read(char *fileNameBuffer, FwSizeType buffSize) override
Get next filename from directory stream.
PosixDirectory()
constructor
Status open(const char *path, OpenMode mode) override
Open or create a directory.
char * string_copy(char *destination, const char *source, FwSizeType num)
copy string with null-termination guaranteed
@ OP_OK
Operation succeeded.
Directory::Status errno_to_directory_status(PlatformIntType errno_input)