MCPcopy Create free account
hub / github.com/ZDoom/Raze / CollectAllFilesInSearchPath

Function CollectAllFilesInSearchPath

source/core/searchpaths.cpp:286–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284};
285
286TArray<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//

Callers 1

GrpScanFunction · 0.85

Calls 11

CollectSearchPathsFunction · 0.85
DirExistsFunction · 0.85
ScanDirectoryFunction · 0.85
GetFileInfoFunction · 0.85
IsNotEmptyMethod · 0.80
ReserveMethod · 0.80
c_strMethod · 0.80
OpenFileMethod · 0.45
GetCharsMethod · 0.45
GetLengthMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected