(string path)
| 805 | } |
| 806 | |
| 807 | void Backup(string path) |
| 808 | { |
| 809 | var orig = path + ".orig"; |
| 810 | if (!File.Exists(orig)) |
| 811 | { |
| 812 | // .orig: never overwritten; atomic copy avoids torn recovery point. |
| 813 | FileUtils.AtomicCopy(path, orig); |
| 814 | Log($" Original saved to {orig}"); |
| 815 | } |
| 816 | |
| 817 | // .bak: rolling per-cycle backup; atomic copy avoids torn restores. |
| 818 | var bak = path + ".bak"; |
| 819 | FileUtils.AtomicCopy(path, bak); |
| 820 | Log($" Backed up to {bak}"); |
| 821 | } |
| 822 | |
| 823 | // Bracket both backups before either write so partial states are recoverable. |
| 824 | void BackupBoth(string firstPath, string secondPath) |
nothing calls this directly
no test coverage detected