| 1335 | } |
| 1336 | |
| 1337 | bool Beefy::RecursiveDeleteDirectory(const StringImpl& dirPath) |
| 1338 | { |
| 1339 | String findSpec = dirPath + "/*.*"; |
| 1340 | bool failed = false; |
| 1341 | |
| 1342 | BfpFileResult result; |
| 1343 | BfpFindFileData* findFileData = BfpFindFileData_FindFirstFile(findSpec.c_str(), (BfpFindFileFlags)(BfpFindFileFlag_Directories | BfpFindFileFlag_Files), &result); |
| 1344 | if (result == BfpFileResult_Ok) |
| 1345 | { |
| 1346 | while (true) |
| 1347 | { |
| 1348 | Beefy::String fileName; |
| 1349 | BFP_GETSTR_HELPER(fileName, result, BfpFindFileData_GetFileName(findFileData, __STR, __STRLEN, &result)); |
| 1350 | |
| 1351 | String filePath = dirPath + "/" + fileName; |
| 1352 | if ((BfpFindFileData_GetFileAttributes(findFileData) & BfpFileAttribute_Directory) != 0) |
| 1353 | { |
| 1354 | if (!RecursiveDeleteDirectory(filePath)) |
| 1355 | failed = true; |
| 1356 | } |
| 1357 | else |
| 1358 | { |
| 1359 | BfpFile_Delete(filePath.c_str(), &result); |
| 1360 | if (result != BfpFileResult_Ok) |
| 1361 | failed = true; |
| 1362 | } |
| 1363 | |
| 1364 | if (!BfpFindFileData_FindNextFile(findFileData)) |
| 1365 | break; |
| 1366 | } |
| 1367 | BfpFindFileData_Release(findFileData); |
| 1368 | } |
| 1369 | else if (result != BfpFileResult_NoResults) |
| 1370 | { |
| 1371 | return false; |
| 1372 | } |
| 1373 | |
| 1374 | BfpDirectory_Delete(dirPath.c_str(), &result); |
| 1375 | return (result == BfpFileResult_Ok) && (!failed); |
| 1376 | } |
| 1377 | |
| 1378 | void Beefy::BFFatalError(const char* message, const char* file, int line) |
| 1379 | { |
nothing calls this directly
no test coverage detected