| 284 | }; |
| 285 | |
| 286 | TArray<FileEntry> CollectAllFilesInSearchPath() |
| 287 | { |
| 288 | uint32_t index = 0; |
| 289 | TArray<FileEntry> filelist; |
| 290 | |
| 291 | if (userConfig.gamegrp.IsNotEmpty()) |
| 292 | { |
| 293 | // If the user specified a file on the command line, insert that first, if found. |
| 294 | FileReader fr; |
| 295 | if (fr.OpenFile(userConfig.gamegrp.GetChars())) |
| 296 | { |
| 297 | FileEntry fe = { userConfig.gamegrp, (size_t)fr.GetLength(), 0, 0, index++ }; |
| 298 | filelist.Push(fe); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | auto paths = CollectSearchPaths(); |
| 303 | for(auto &path : paths) |
| 304 | { |
| 305 | if (DirExists(path.GetChars())) |
| 306 | { |
| 307 | FileSys::FileList list; |
| 308 | if (FileSys::ScanDirectory(list, path.GetChars(), "*", true)) |
| 309 | { |
| 310 | for (auto& entry : list) |
| 311 | { |
| 312 | if (!entry.isDirectory) |
| 313 | { |
| 314 | filelist.Reserve(1); |
| 315 | auto& flentry = filelist.Last(); |
| 316 | flentry.FileName = entry.FilePath.c_str(); |
| 317 | GetFileInfo(flentry.FileName.GetChars(), &flentry.FileLength, &flentry.FileTime); |
| 318 | flentry.Index = index++; // to preserve order when working on the list. |
| 319 | |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | return filelist; |
| 326 | } |
| 327 | |
| 328 | //========================================================================== |
| 329 | // |
no test coverage detected