Removes a file, then renames another file to be the removed file. Get it? Returns 1 on success, else 0 on fail
| 1462 | // Removes a file, then renames another file to be the removed file. Get it? |
| 1463 | // Returns 1 on success, else 0 on fail |
| 1464 | int SwitcherooFiles(const char *name, char *tempname) { |
| 1465 | /*// If we're changing the net table file, make a backup first! |
| 1466 | if ((!stricmp (name,TableFilename))) |
| 1467 | { |
| 1468 | cf_CopyFile (BackupTableFilename,TableFilename); |
| 1469 | cf_CopyFile (BackupLockFilename,TableLockFilename); |
| 1470 | }*/ |
| 1471 | int num_tries = 0; |
| 1472 | while (!ddio_DeleteFile(name) && num_tries < MAX_TRIES) { |
| 1473 | Sleep(100); |
| 1474 | num_tries++; |
| 1475 | } |
| 1476 | if (num_tries >= MAX_TRIES) { |
| 1477 | strcpy(ErrorString, "MANAGE:There was a problem deleting the table file."); |
| 1478 | ASSERT(0); // GET JASON IMMEDIATELY |
| 1479 | Int3(); |
| 1480 | return (0); |
| 1481 | } |
| 1482 | num_tries = 0; |
| 1483 | while ((rename(tempname, name)) && num_tries <= MAX_TRIES) { |
| 1484 | Sleep(100); |
| 1485 | num_tries++; |
| 1486 | } |
| 1487 | if (num_tries >= MAX_TRIES) { |
| 1488 | strcpy(ErrorString, "MANAGE:There was a problem renaming the temp file."); |
| 1489 | ASSERT(0); // Get JASON IMMEDIATELY |
| 1490 | Int3(); |
| 1491 | return (0); |
| 1492 | } |
| 1493 | |
| 1494 | return 1; |
| 1495 | } |
| 1496 | |
| 1497 | void mng_TransferPages() { |
| 1498 | CFILE *infile, *outfile; |
no test coverage detected