MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / CheckCascBuildFileExact

Function CheckCascBuildFileExact

src/External/CascLib/src/CascFiles.cpp:1494–1526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1492}
1493
1494DWORD CheckCascBuildFileExact(CASC_BUILD_FILE & BuildFile, LPCTSTR szLocalPath)
1495{
1496 // Calculate the length of the local path
1497 TFileStream * pStream;
1498 LPCTSTR szFileType;
1499 size_t nLength = _tcslen(szLocalPath);
1500
1501 // Clear the build file structure
1502 memset(&BuildFile, 0, sizeof(CASC_BUILD_FILE));
1503
1504 // Check every type of the build file
1505 for(size_t i = 0; i < _countof(BuildTypes); i++)
1506 {
1507 // We support any file name with the appropriate ending,
1508 // for example wow-19342.build.info or wow-47186.versions
1509 szFileType = szLocalPath + nLength - BuildTypes[i].nLength;
1510 if(!_tcsicmp(BuildTypes[i].szFileName, szFileType))
1511 {
1512 // We also try to open the file
1513 if((pStream = FileStream_OpenFile(szLocalPath, 0)) != NULL)
1514 {
1515 CascStrCopy(BuildFile.szFullPath, _countof(BuildFile.szFullPath), szLocalPath);
1516 BuildFile.szPlainName = GetPlainFileName(BuildFile.szFullPath);
1517 BuildFile.BuildFileType = BuildTypes[i].BuildFileType;
1518 FileStream_Close(pStream);
1519 return ERROR_SUCCESS;
1520 }
1521 }
1522 }
1523
1524 // Unrecognized file name
1525 return ERROR_FILE_NOT_FOUND;
1526}
1527
1528DWORD CheckCascBuildFileDirs(CASC_BUILD_FILE & BuildFile, LPCTSTR szLocalPath)
1529{

Callers 2

CascOpenStorageExFunction · 0.85
CheckCascBuildFileDirsFunction · 0.85

Calls 4

FileStream_OpenFileFunction · 0.85
CascStrCopyFunction · 0.85
GetPlainFileNameFunction · 0.85
FileStream_CloseFunction · 0.85

Tested by

no test coverage detected