27 DIR* dir = ::opendir(dirName);
30 this->m_lastError = errno;
60 DIR* dir =
reinterpret_cast<DIR*
>(this->m_dir);
71 return this->
read(fileNameBuffer, bufSize, dummy);
85 DIR* dir =
reinterpret_cast<DIR*
>(this->m_dir);
90 struct dirent *direntData =
nullptr;
91 while ((direntData = ::readdir(dir)) !=
nullptr) {
93 if (direntData->d_name[0] !=
'.') {
94 strncpy(fileNameBuffer, direntData->d_name, bufSize);
95 inode = direntData->d_ino;
100 if (direntData ==
nullptr) {
105 this->m_lastError = errno;
116 return this->m_dir > 0;
121 DIR* dir =
reinterpret_cast<DIR*
>(this->m_dir);
122 (void)::closedir(dir);
128 return this->m_lastError;
132 return strerror(this->m_lastError);
PlatformPointerCastType POINTER_CAST
PlatformIntType NATIVE_INT_TYPE
C++-compatible configuration header for fprime configuration.
@ OP_OK
Operation was successful.
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.
@ NO_PERMISSION
No permission to read directory.
@ NO_MORE_FILES
Directory stream has no more files.
@ NOT_DIR
Path is not a directory.
@ DOESNT_EXIST
Directory doesn't exist.
@ NOT_OPENED
Directory hasn't been opened yet.
bool isOpen()
check if file descriptor is open or not.
void close()
close directory
Status rewind()
rewind directory stream to the beginning
Status read(char *fileNameBuffer, U32 bufSize)
get next filename from directory
const char * getLastErrorString()
get a string of the last error (typically from strerror)
Status open(const char *dirName)
open directory. Directory must already exist
NATIVE_INT_TYPE getLastError()
read back last error code (typically errno)
virtual ~Directory()
Destructor. Will close directory if still open.