openMSX
ReadDir.cc
Go to the documentation of this file.
1 #include "ReadDir.hh"
2 
3 namespace openmsx {
4 
5 ReadDir::ReadDir(const std::string& directory)
6 {
7  dir = opendir(directory.empty() ? "." : directory.c_str());
8 }
9 
11 {
12  if (dir) {
13  closedir(dir);
14  }
15 }
16 
17 struct dirent* ReadDir::getEntry()
18 {
19  if (!dir) {
20  return nullptr;
21  }
22  return readdir(dir);
23 }
24 
25 bool ReadDir::isValid() const
26 {
27  return dir != nullptr;
28 }
29 
30 } // namespace openmsx