MCPcopy Create free account
hub / github.com/Samsung/UTopia / readDirectory

Function readDirectory

lib/utils/FileUtil.cpp:97–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97std::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
121int makeDir(std::string path) {
122 std::cout << "[COMMAND] mkdir " << path << '\n';

Callers 3

loadTargetMethod · 0.85
UTLoaderMethod · 0.85
loadExternalsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected