================ FS_GetFileList ================ */
| 2186 | ================ |
| 2187 | */ |
| 2188 | int 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 | ======================= |
no test coverage detected