MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / IsDirectoryEmpty

Method IsDirectoryEmpty

Goldleaf/source/fs/fs_StdExplorer.cpp:78–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 }
77
78 bool StdExplorer::IsDirectoryEmpty(const std::string &dir_path) {
79 const auto full_path = this->MakeFull(dir_path);
80
81 auto dp = opendir(full_path.c_str());
82 if(dp != nullptr) {
83 while(true) {
84 auto dt = readdir(dp);
85 if(dt == nullptr) {
86 break;
87 }
88
89 const std::string name = dt->d_name;
90 if((name != ".") && (name != "..")) {
91 closedir(dp);
92 return false;
93 }
94 }
95 closedir(dp);
96 }
97 return true;
98 }
99
100 bool StdExplorer::Exists(const std::string &path) {
101 const auto full_path = this->MakeFull(path);

Callers 1

UpdateElementsMethod · 0.45

Calls 1

MakeFullMethod · 0.80

Tested by

no test coverage detected