| 409 | {} |
| 410 | |
| 411 | void getFilesAndDirsWithFindImpl(const std::wstring& path, Directory& d) |
| 412 | { |
| 413 | const std::wstring searchString = path + L"\\*"; |
| 414 | |
| 415 | WIN32_FIND_DATAW findData; |
| 416 | |
| 417 | HANDLE searchHandle = |
| 418 | ::FindFirstFileExW(searchString.c_str(), FindExInfoBasic, &findData, |
| 419 | FindExSearchNameMatch, nullptr, FIND_FIRST_EX_LARGE_FETCH); |
| 420 | |
| 421 | if (searchHandle != INVALID_HANDLE_VALUE) { |
| 422 | BOOL result = true; |
| 423 | |
| 424 | while (result) { |
| 425 | if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { |
| 426 | if ((wcscmp(findData.cFileName, L".") != 0) && |
| 427 | (wcscmp(findData.cFileName, L"..") != 0)) { |
| 428 | const std::wstring newPath = path + L"\\" + findData.cFileName; |
| 429 | d.dirs.push_back(Directory(findData.cFileName)); |
| 430 | getFilesAndDirsWithFindImpl(newPath, d.dirs.back()); |
| 431 | } |
| 432 | } else { |
| 433 | const auto size = |
| 434 | (findData.nFileSizeHigh * (MAXDWORD + 1)) + findData.nFileSizeLow; |
| 435 | |
| 436 | d.files.push_back(File(findData.cFileName, findData.ftLastWriteTime, size)); |
| 437 | } |
| 438 | |
| 439 | result = ::FindNextFileW(searchHandle, &findData); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | ::FindClose(searchHandle); |
| 444 | } |
| 445 | |
| 446 | Directory getFilesAndDirsWithFind(const std::wstring& path) |
| 447 | { |
no test coverage detected