using System.IO; namespace Unity.Pipeline { /// /// The one piece of "rotate a log file" that PipelineTransactionLog (a whole-file JSON /// array, rotated once per Unity session) and EvalUsageTelemetry (true JSONL, rotated on /// a byte-size cap) actually share verbatim: swapping the active file for a backup. Everything /// else — the append shape, the lock, and what triggers a rotation — differs enough between the /// two that forcing them into one bigger "rotating append log" abstraction would cost more /// clarity than the duplication it removes, so only this file-swap step is factored out. /// static class RotatingFileBackup { /// /// Move to , replacing any prior /// backup, so the active path is free for a fresh file. No-op when there is no active file. /// Callers are responsible for their own locking around this — it performs no synchronization /// itself. /// public static void RotateToBackup(string activePath, string backupPath) { if (!File.Exists(activePath)) return; if (File.Exists(backupPath)) File.Delete(backupPath); File.Move(activePath, backupPath); } } }