MCPcopy Create free account
hub / github.com/csound/csound / FileList_getFileCount

Function FileList_getFileCount

Emscripten/src/FileList.c:27–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#include <emscripten.h>
26
27EMSCRIPTEN_KEEPALIVE
28size_t FileList_getFileCount(const char *directoryPath)
29{
30 struct dirent *directoryEntry;
31 DIR *directory = opendir(directoryPath);
32 size_t fileCount = 0;
33 if (directory) {
34
35 while ((directoryEntry = readdir(directory)) != NULL) {
36
37 struct stat st;
38 lstat(directoryEntry->d_name, &st);
39
40 if (S_ISDIR(st.st_mode)) {
41
42 continue;
43 }
44 else {
45 fileCount++;
46 }
47 }
48
49 closedir(directory);
50 }
51
52 return fileCount;
53}
54
55
56EMSCRIPTEN_KEEPALIVE

Callers 1

Calls 1

readdirFunction · 0.85

Tested by

no test coverage detected