MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / FindAllFilesSize

Function FindAllFilesSize

Descent3/pilot.cpp:2290–2311  ·  view source on GitHub ↗

FindAllFilesSize Looks in the current directory and returns the number of bytes of memory that will be needed for a buffer of filenames (see FindAllFiles()). pattern = wildcard pattern to match filecount = will be filled in with the number of files it finds

Source from the content-addressed store, hash-verified

2288// pattern = wildcard pattern to match
2289// filecount = will be filled in with the number of files it finds
2290int FindAllFilesSize(const char *pattern, int *filecount) {
2291 if (!pattern) {
2292 *filecount = 0;
2293 return 0;
2294 }
2295
2296 char filename[_MAX_PATH];
2297 int size = 0;
2298 int count = 0;
2299
2300 if (ddio_FindFileStart(pattern, filename)) {
2301 count++;
2302 size += strlen(filename) + 1;
2303 while (ddio_FindNextFile(filename)) {
2304 count++;
2305 size += strlen(filename) + 1;
2306 }
2307 ddio_FindFileClose();
2308 }
2309 *filecount = count;
2310 return size;
2311}
2312
2313// returns the optimal distance to place the camera
2314float getdist(angle ang, float height) {

Callers 1

UpdateGraphicsListboxFunction · 0.85

Calls 3

ddio_FindFileStartFunction · 0.50
ddio_FindNextFileFunction · 0.50
ddio_FindFileCloseFunction · 0.50

Tested by

no test coverage detected