Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/c#/GeneralUpdate.Differential/Pipeline/DiffPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,18 @@ private async Task ApplyPatch(string appFilePath, string patchFilePath, Cancella

await _binaryDiffer.DirtyAsync(appFilePath, tempPath, patchFilePath, ct);

if (File.Exists(appFilePath))
// Some differ implementations (e.g., BinaryHandler) perform atomic replacement
// internally: they delete oldPath and copy tempPath back to oldPath, then delete tempPath.
// We only handle the replacement ourselves when the differ left tempPath intact.
if (File.Exists(tempPath))
{
File.SetAttributes(appFilePath, FileAttributes.Normal);
File.Delete(appFilePath);
if (File.Exists(appFilePath))
{
File.SetAttributes(appFilePath, FileAttributes.Normal);
File.Delete(appFilePath);
}
File.Move(tempPath, appFilePath);
}
File.Move(tempPath, appFilePath);
}

private static void HandleDeleteList(IEnumerable<FileInfo> patchFiles, IEnumerable<FileInfo> oldFiles)
Expand Down
Loading