| 1492 | } |
| 1493 | |
| 1494 | DWORD 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 | |
| 1528 | DWORD CheckCascBuildFileDirs(CASC_BUILD_FILE & BuildFile, LPCTSTR szLocalPath) |
| 1529 | { |
no test coverage detected