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

Function ConnectUGCDirectoryToFile

src/ColdAPI_Steam/ColdManager.cpp:256–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254 return nullptr;
255 }
256 char* ConnectUGCDirectoryToFile(const char* FileName)
257 {
258 // Variables
259 char* tempbuffer = nullptr;
260 char* FileAndDir = nullptr;
261 int ConstantDirLength = std::strlen(Steam_Config::UGCDirectotry);
262 int ProvidedStringLength = std::strlen(FileName);
263 int CalcSize = ConstantDirLength + ProvidedStringLength;
264
265 FileAndDir = (char*)VirtualAlloc(nullptr, CalcSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
266
267 if (FileAndDir)
268 {
269 tempbuffer = (char*)VirtualAlloc(nullptr, CalcSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
270
271 if (tempbuffer)
272 {
273 std::strcpy(FileAndDir, Steam_Config::UGCDirectotry);
274 std::strcpy(&FileAndDir[ConstantDirLength], FileName);
275
276 for (int i = 0; i < ProvidedStringLength; i++, ConstantDirLength++)
277 {
278 if (FileAndDir[ConstantDirLength] == '\\' || FileAndDir[ConstantDirLength] == '/')
279 {
280 std::memcpy(tempbuffer, FileAndDir, ConstantDirLength);
281 DWORD ftyp = GetFileAttributesA(tempbuffer);
282 if (ftyp == INVALID_FILE_ATTRIBUTES) {
283 CreateDirectoryA(tempbuffer, NULL);
284 }
285 }
286 }
287 VirtualFree(tempbuffer, NULL, MEM_RELEASE);
288 return FileAndDir;
289 }
290 VirtualFree(FileAndDir, NULL, MEM_RELEASE);
291 }
292 return nullptr;
293 }
294 static bool Ready = false;
295 const char* GetStorageDirectory()
296 {

Callers 15

UGCDownloadMethod · 0.85
GetUGCDetailsMethod · 0.85
UGCReadMethod · 0.85
UGCDownloadMethod · 0.85
GetUGCDetailsMethod · 0.85
UGCReadMethod · 0.85
UGCDownloadMethod · 0.85
GetUGCDetailsMethod · 0.85
UGCReadMethod · 0.85
UGCDownloadMethod · 0.85
GetUGCDetailsMethod · 0.85
UGCReadMethod · 0.85

Calls

no outgoing calls

Tested by 15

UGCDownloadMethod · 0.68
GetUGCDetailsMethod · 0.68
UGCReadMethod · 0.68
UGCDownloadMethod · 0.68
GetUGCDetailsMethod · 0.68
UGCReadMethod · 0.68
UGCDownloadMethod · 0.68
GetUGCDetailsMethod · 0.68
UGCReadMethod · 0.68
UGCDownloadMethod · 0.68
GetUGCDetailsMethod · 0.68
UGCReadMethod · 0.68