Skip to content

Commit

Permalink
Improbed copier stability.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed May 13, 2024
1 parent 8c20cb2 commit 9a99331
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions chibild/chibild.core/Internal/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ public static void SafeCopy(string from, string to)
}
catch
{
File.Delete(to1);
throw;
isExistTo = false;
}
}

Expand All @@ -172,14 +171,21 @@ public static void SafeCopy(string from, string to)
File.Delete(to1);
if (isExistTo)
{
File.Move(to2, to);
try
{
File.Move(to2, to);
}
catch
{
File.Delete(to2);
}
}
throw;
return;
}

if (isExistTo)
{
File.Delete(to2);
}
}
}
}

0 comments on commit 9a99331

Please sign in to comment.