MCPcopy Create free account
hub / github.com/Inori/GPCS4 / FileCountInDirectory

Function FileCountInDirectory

GPCS4/Platform/PlatPath.cpp:41–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41size_t FileCountInDirectory(const std::string &path)
42{
43 int counter = 0;
44 WIN32_FIND_DATA ffd;
45 HANDLE hFind = INVALID_HANDLE_VALUE;
46 std::string dirPath = path;
47 if (dirPath.at(dirPath.length() - 1) != '\\' &&
48 dirPath.at(dirPath.length() - 1) != '/')
49 {
50 dirPath.append("\\");
51 }
52 dirPath.append("*");
53
54 // Start iterating over the files in the path directory.
55 hFind = FindFirstFileA(dirPath.c_str(), &ffd);
56 if (hFind != INVALID_HANDLE_VALUE)
57 {
58 do // Managed to locate and create an handle to that folder.
59 {
60 counter++;
61 } while (FindNextFileA(hFind, &ffd) == TRUE);
62 FindClose(hFind);
63 }
64 else
65 {
66 LOG_ERR("Failed to find path: %s", dirPath.c_str());
67 }
68
69 return counter;
70}
71
72bool splitFileName(std::string const &fileName,
73 std::string *name,

Callers 2

sceKernelStatFunction · 0.85
sceKernelFstatFunction · 0.85

Calls 4

atMethod · 0.45
lengthMethod · 0.45
appendMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected