Skip to content

Commit

Permalink
Fix readonly files can't be copied on the 2nd stage of the update (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
MahBoiDeveloper authored Jan 3, 2025
1 parent 81da2a3 commit 9cc4934
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions SecondStageUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,17 @@ private static void Main(string[] args)
try
{
FileInfo copiedFile = SafePath.GetFile(baseDirectory.FullName, relativeFileName);
bool isReadOnly = copiedFile.IsReadOnly;

Write($"Updating {relativeFileName}");

if (isReadOnly)
copiedFile.IsReadOnly = false;

fileInfo.CopyTo(copiedFile.FullName, true);

if (isReadOnly)
copiedFile.IsReadOnly = true;
}
catch (Exception ex)
{
Expand Down

0 comments on commit 9cc4934

Please sign in to comment.