MCPcopy Create free account
hub / github.com/dobin/RedEdr / GetFilesInDirectory

Function GetFilesInDirectory

RedEdr/webserver.cpp:50–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48
49
50std::vector<std::wstring> GetFilesInDirectory(const std::wstring& directory) {
51 std::vector<std::wstring> files;
52 WIN32_FIND_DATA findFileData;
53 HANDLE hFind = FindFirstFile(directory.c_str(), &findFileData);
54
55 if (hFind == INVALID_HANDLE_VALUE) {
56 // Can be empty, ignore
57 if (g_Config.debug) {
58 LOG_W(LOG_INFO, L"No files found in %s", directory.c_str());
59 }
60 return files;
61 }
62
63 do {
64 const std::wstring fileOrDir = findFileData.cFileName;
65 if (fileOrDir != L"." && fileOrDir != L"..") {
66 files.push_back(StripToFirstDot(fileOrDir));
67 }
68 } while (FindNextFile(hFind, &findFileData) != 0);
69
70 FindClose(hFind);
71 return files;
72}
73
74
75std::string getRecordingsAsJson() {

Callers 1

getRecordingsAsJsonFunction · 0.85

Calls 2

StripToFirstDotFunction · 0.85
LOG_WFunction · 0.70

Tested by

no test coverage detected