MCPcopy Create free account
hub / github.com/Singular/Singular / ListFiles

Function ListFiles

ppcc/adlib/os.cc:260–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260StrArr *ListFiles(const char *path) {
261#ifdef HAVE_DIRENT_H
262 StrArr *result = new StrArr();
263 DIR *dir = opendir(path);
264 if (!dir)
265 return NULL;
266 for (;;) {
267 struct dirent *entry = readdir(dir);
268 if (!entry)
269 break;
270 if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
271 continue;
272 result->add(new Str(entry->d_name));
273 }
274 closedir(dir);
275 return result;
276#else
277 return NULL;
278#endif
279}
280
281StrArr *ListFiles(Str *path) {
282 return ListFiles(path->c_str());

Callers 2

MainFunction · 0.85
WalkDirFunction · 0.85

Calls 5

opendirFunction · 0.85
readdirFunction · 0.85
closedirFunction · 0.85
c_strMethod · 0.80
addMethod · 0.45

Tested by 1

MainFunction · 0.68