21 : dir(opendir(directory.empty() ?
"." : directory.c_str())) {}
28 if (!dir)
return nullptr;
29 return readdir(dir.get());
34 [[nodiscard]]
bool isValid()
const {
return dir !=
nullptr; }
38 void operator()(DIR* d)
const {
if (d) closedir(d); }
40 using DIR_t = std::unique_ptr<DIR, CloseDir>;
Simple wrapper around opendir() / readdir() / closedir() functions.
struct dirent * getEntry()
Get directory entry for next file.
ReadDir(zstring_view directory)
bool isValid() const
Is the given directory valid (does it exist)?
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions: