MCPcopy Create free account
hub / github.com/JACoders/OpenJK / FS_GetFileList

Function FS_GetFileList

code/qcommon/files.cpp:2188–2218  ·  view source on GitHub ↗

================ FS_GetFileList ================ */

Source from the content-addressed store, hash-verified

2186================
2187*/
2188int FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) {
2189 int nFiles, i, nTotal, nLen;
2190 char **pFiles = NULL;
2191
2192 *listbuf = 0;
2193 nFiles = 0;
2194 nTotal = 0;
2195
2196 if (Q_stricmp(path, "$modlist") == 0) {
2197 return FS_GetModList(listbuf, bufsize);
2198 }
2199
2200 pFiles = FS_ListFiles(path, extension, &nFiles);
2201
2202 for (i =0; i < nFiles; i++) {
2203 nLen = strlen(pFiles[i]) + 1;
2204 if (nTotal + nLen + 1 < bufsize) {
2205 strcpy(listbuf, pFiles[i]);
2206 listbuf += nLen;
2207 nTotal += nLen;
2208 }
2209 else {
2210 nFiles = i;
2211 break;
2212 }
2213 }
2214
2215 FS_FreeFileList(pFiles);
2216
2217 return nFiles;
2218}
2219
2220/*
2221=======================

Callers 2

CL_UISystemCallsFunction · 0.50
UI_LoadModsFunction · 0.50

Calls 4

Q_stricmpFunction · 0.85
FS_GetModListFunction · 0.70
FS_ListFilesFunction · 0.70
FS_FreeFileListFunction · 0.70

Tested by

no test coverage detected