MCPcopy Create free account
hub / github.com/Rat431/ColdAPI_Steam / FillFileStructure

Function FillFileStructure

src/ColdAPI_Steam/ColdManager.cpp:336–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334 return Steam_Config::SaveDirectory;
335 }
336 void FillFileStructure(const char* Directory)
337 {
338 // List files
339 WIN32_FIND_DATAA FindFileData;
340 HANDLE hFind = INVALID_HANDLE_VALUE;
341 char path[MAX_PATH + 0x200] = { 0 };
342 char tmp[MAX_PATH + 0x200] = { 0 };
343 int SaveDirL = std::strlen(Steam_Config::SaveDirectory);
344 int UGCSaveDirL = std::strlen(Steam_Config::UGCDirectotry);
345 std::string Path = Directory;
346
347 Path.append("*");
348
349 hFind = FindFirstFileA(Path.c_str(), &FindFileData);
350 if (hFind != INVALID_HANDLE_VALUE)
351 {
352 do
353 {
354 if ((std::strncmp(".", (char*)FindFileData.cFileName, 1) != 0) && (std::strncmp("..", (char*)FindFileData.cFileName, 2) != 0))
355 {
356 if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
357 if (std::strncmp(Directory, Steam_Config::SaveDirectory, SaveDirL) == 0) {
358 std::memset(tmp, 0, sizeof(tmp));
359 std::memcpy(tmp, &Directory[SaveDirL], (std::strlen(Directory) - SaveDirL));
360 std::strcat(tmp, (char*)FindFileData.cFileName);
361 FilesMatrix.push_back(tmp);
362 }
363 else if (std::strncmp(Directory, Steam_Config::UGCDirectotry, UGCSaveDirL) == 0) {
364 std::memset(tmp, 0, sizeof(tmp));
365 std::memcpy(tmp, &Directory[UGCSaveDirL], (std::strlen(Directory) - UGCSaveDirL));
366 std::strcat(tmp, (char*)FindFileData.cFileName);
367 FilesMatrix.push_back(tmp);
368 }
369 else {
370 FilesMatrix.push_back((char*)FindFileData.cFileName);
371 }
372 }
373 else {
374 // Loop
375 std::sprintf(path, "%s%s/", Directory, (char*)FindFileData.cFileName);
376 FillFileStructure(path);
377 }
378 }
379 } while (FindNextFileA(hFind, &FindFileData) == TRUE);
380 FindClose(hFind);
381 }
382 }
383 void Storage_Initializzation()
384 {
385 std::strcpy(Steam_Config::UGCDirectotry, Steam_Config::SaveDirectory);

Callers 15

GetFileCountMethod · 0.85
GetFileNameAndSizeMethod · 0.85
GetFileCountMethod · 0.85
GetFileNameAndSizeMethod · 0.85
UGCDownloadMethod · 0.85
GetUGCDetailsMethod · 0.85
UGCReadMethod · 0.85
GetFileCountMethod · 0.85
GetFileNameAndSizeMethod · 0.85
GetFileCountMethod · 0.85
GetFileNameAndSizeMethod · 0.85
UGCDownloadMethod · 0.85

Calls

no outgoing calls

Tested by 15

GetFileCountMethod · 0.68
GetFileNameAndSizeMethod · 0.68
GetFileCountMethod · 0.68
GetFileNameAndSizeMethod · 0.68
UGCDownloadMethod · 0.68
GetUGCDetailsMethod · 0.68
UGCReadMethod · 0.68
GetFileCountMethod · 0.68
GetFileNameAndSizeMethod · 0.68
GetFileCountMethod · 0.68
GetFileNameAndSizeMethod · 0.68
UGCDownloadMethod · 0.68