Skip to content

Commit 1da8dd4

Browse files
committed
fix: File is in use, File has been deleted
1 parent 242c1b5 commit 1da8dd4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/c#/GeneralUpdate.Differential/Binary/BinaryHandler.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,17 @@ await Task.Run(() =>
363363
}
364364
}
365365

366-
File.SetAttributes(_oldfilePath, FileAttributes.Normal);
367-
File.Delete(_oldfilePath);
368-
File.Move(_newfilePath, _oldfilePath);
366+
if (File.Exists(_oldfilePath))
367+
{
368+
File.SetAttributes(_oldfilePath, FileAttributes.Normal);
369+
File.Delete(_oldfilePath);
370+
}
371+
372+
if (File.Exists(_newfilePath))
373+
{
374+
File.SetAttributes(_newfilePath, FileAttributes.Normal);
375+
File.Move(_newfilePath, _oldfilePath);
376+
}
369377
});
370378
}
371379

0 commit comments

Comments
 (0)