| 95 | } |
| 96 | |
| 97 | std::vector<std::string> readDirectory(const std::string &dirPath) { |
| 98 | std::vector<std::string> fileList; |
| 99 | |
| 100 | if (!fs::is_directory(fs::status(dirPath))) { |
| 101 | throw std::invalid_argument("Not Directory"); |
| 102 | } |
| 103 | |
| 104 | DIR *dirPtr = opendir(dirPath.c_str()); |
| 105 | assert(dirPtr && "Unexpected Program State"); |
| 106 | |
| 107 | struct dirent *direntPtr; |
| 108 | while ((direntPtr = readdir(dirPtr)) != nullptr) { |
| 109 | std::string fileName = direntPtr->d_name; |
| 110 | if (fileName == "." || fileName == "..") { |
| 111 | continue; |
| 112 | } |
| 113 | |
| 114 | std::string fullPath = dirPath + PATH_SEPARATOR + direntPtr->d_name; |
| 115 | fileList.push_back(fullPath); |
| 116 | } |
| 117 | closedir(dirPtr); |
| 118 | return fileList; |
| 119 | } |
| 120 | |
| 121 | int makeDir(std::string path) { |
| 122 | std::cout << "[COMMAND] mkdir " << path << '\n'; |
no outgoing calls
no test coverage detected