| 99 | } |
| 100 | |
| 101 | void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V, long *Epoch, |
| 102 | size_t MaxSize, bool ExitOnError, |
| 103 | std::vector<std::string> *VPaths) { |
| 104 | long E = Epoch ? *Epoch : 0; |
| 105 | std::vector<std::string> Files; |
| 106 | ListFilesInDirRecursive(Path, Epoch, &Files, /*TopDir*/true); |
| 107 | size_t NumLoaded = 0; |
| 108 | for (size_t i = 0; i < Files.size(); i++) { |
| 109 | auto &X = Files[i]; |
| 110 | if (Epoch && GetEpoch(X) < E) continue; |
| 111 | NumLoaded++; |
| 112 | if ((NumLoaded & (NumLoaded - 1)) == 0 && NumLoaded >= 1024) |
| 113 | Printf("Loaded %zd/%zd files from %s\n", NumLoaded, Files.size(), Path); |
| 114 | auto S = FileToVector(X, MaxSize, ExitOnError); |
| 115 | if (!S.empty()) { |
| 116 | V->push_back(S); |
| 117 | if (VPaths) |
| 118 | VPaths->push_back(X); |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | void GetSizedFilesFromDir(const std::string &Dir, std::vector<SizedFile> *V) { |
| 124 | std::vector<std::string> Files; |
no test coverage detected