MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / file_list

Method file_list

ogsr_engine/xrCore/LocatorAPI.cpp:869–952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

867}
868
869int CLocatorAPI::file_list(FS_FileSet& dest, LPCSTR path, u32 flags, LPCSTR mask)
870{
871 R_ASSERT(path);
872 VERIFY(flags);
873
874 string_path N;
875 if (path_exist(path))
876 update_path(N, path, "");
877 else
878 strcpy_s(N, path);
879
880 files_it I = file_find_it(N);
881 if (I == files.end())
882 return 0;
883
884 SStringVec masks;
885 _SequenceToList(masks, mask);
886 BOOL b_mask = !masks.empty();
887
888 size_t base_len = xr_strlen(N);
889 for (++I; I != files.end(); ++I)
890 {
891 const file& entry = *I;
892 if (0 != strncmp(entry.name, N, base_len))
893 break; // end of list
894
895 LPCSTR end_symbol = entry.name + xr_strlen(entry.name) - 1;
896 if ((*end_symbol) != '\\')
897 {
898 // file
899 if ((flags & FS_ListFiles) == 0)
900 continue;
901
902 LPCSTR entry_begin = entry.name + base_len;
903 if ((flags & FS_RootOnly) && strchr(entry_begin, '\\'))
904 continue; // folder in folder
905
906 // check extension
907 if (b_mask)
908 {
909 bool bOK = false;
910 for (auto& mask : masks)
911 {
912 if (pattern_match(entry_begin, mask.c_str()))
913 {
914 bOK = true;
915 break;
916 }
917 }
918 if (!bOK)
919 continue;
920 }
921
922 xr_string fn = entry_begin;
923
924 // insert file entry
925 if (flags & FS_ClampExt)
926 {

Callers 11

ReadTextureInfoMethod · 0.80
get_files_listFunction · 0.80
FS_file_list_exMethod · 0.80
LoadMethod · 0.80
LoadLTXMethod · 0.80
LoadTHMMethod · 0.80
LoadMethod · 0.80
Load2Method · 0.80
init_gamedata_unusedMethod · 0.80
LoadMethod · 0.80
ParseFileFunction · 0.80

Calls 9

_SequenceToListFunction · 0.85
strextFunction · 0.85
replaceMethod · 0.80
emplaceMethod · 0.80
xr_strlenFunction · 0.70
endMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected