MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / DeleteDirectory

Function DeleteDirectory

Tests/PresentMonTests.cpp:42–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40namespace {
41
42void DeleteDirectory(std::wstring const& dir)
43{
44 WIN32_FIND_DATA ff = {};
45 auto h = FindFirstFile((dir + L'*').c_str(), &ff);
46 if (h == INVALID_HANDLE_VALUE) {
47 return;
48 }
49 do
50 {
51 if (ff.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
52 if (wcscmp(ff.cFileName, L".") == 0) continue;
53 if (wcscmp(ff.cFileName, L"..") == 0) continue;
54 DeleteDirectory(dir + ff.cFileName + L'\\');
55 } else {
56 DeleteFile((dir + ff.cFileName).c_str());
57 }
58 } while (FindNextFile(h, &ff) != 0);
59
60 RemoveDirectory(dir.substr(0, dir.size() - 1).c_str());
61
62 FindClose(h);
63}
64
65bool CheckPath(
66 char const* commandLineArg,

Callers 1

wmainFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected