| 34 | } |
| 35 | |
| 36 | int32_t TaskFile::GetNumFiles() |
| 37 | { |
| 38 | if (!lines.empty()) |
| 39 | return totalFiles; |
| 40 | |
| 41 | FileWrapper fs{ _wfopen(m_path.data(), L"rb") }; |
| 42 | if (!fs) |
| 43 | return 0; |
| 44 | |
| 45 | int32_t count{}; |
| 46 | while (true) |
| 47 | { |
| 48 | size_t length{}; |
| 49 | if (!fs.read(&length, sizeof(length), 1)) |
| 50 | break; |
| 51 | |
| 52 | std::wstring line(length, {}); |
| 53 | |
| 54 | if (!fs.read(line.data(), 2, length)) |
| 55 | break; |
| 56 | |
| 57 | if (std::filesystem::is_directory(line)) |
| 58 | numFiles.push_back(getNumFilesInFolder(line)); |
| 59 | else |
| 60 | numFiles.push_back(1); |
| 61 | count += numFiles.back(); |
| 62 | lines.push_back(std::move(line)); |
| 63 | } |
| 64 | numFiles.resize(lines.size()); |
| 65 | totalFiles = count; |
| 66 | return count; |
| 67 | } |
| 68 | |
| 69 | int32_t TaskFile::GetNumFiles(int index) |
| 70 | { |
no test coverage detected