| 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); |
no test coverage detected