| 40 | namespace { |
| 41 | |
| 42 | void 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 | |
| 65 | bool CheckPath( |
| 66 | char const* commandLineArg, |