| 28 | #include <string.h> |
| 29 | |
| 30 | STDirectory::STDirectory(const std::string& root) : mError(0), mGood(false) |
| 31 | { |
| 32 | DIR* dir = opendir(root.c_str()); |
| 33 | |
| 34 | if (dir == NULL) |
| 35 | { |
| 36 | mError = (Result)errno; |
| 37 | closedir(dir); |
| 38 | return; |
| 39 | } |
| 40 | else |
| 41 | { |
| 42 | struct dirent* ent; |
| 43 | while ((ent = readdir(dir))) |
| 44 | { |
| 45 | // Don't insert the implicit . and .. folders because ew |
| 46 | if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, "..")) |
| 47 | { |
| 48 | mList.emplace_back(ent->d_name, ent->d_type == DT_DIR); |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | closedir(dir); |
| 54 | mGood = true; |
| 55 | } |
| 56 | |
| 57 | Result STDirectory::error(void) |
| 58 | { |
nothing calls this directly
no outgoing calls
no test coverage detected