MCPcopy Create free account
hub / github.com/HO-COOH/FastCopy / GetNumFiles

Method GetNumFiles

FastCopy/TaskFile.cpp:36–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36int32_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
69int32_t TaskFile::GetNumFiles(int index)
70{

Callers 3

RecordFileMethod · 0.80
ItemCountMethod · 0.80
StartMethod · 0.80

Calls 5

getNumFilesInFolderFunction · 0.85
dataMethod · 0.80
backMethod · 0.80
sizeMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected