Skip to content

Commit

Permalink
Backup unmodified files
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyw15 committed May 6, 2024
1 parent bd35f70 commit bfb7300
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AssemblyPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public static void ReplaceFile(string cevioInstallPath)
{
var sourcePath = Path.GetFullPath(TARGET_FILE);
var targetPath = Path.Combine(cevioInstallPath, TARGET_FILE);
// backup unmodified file
File.Copy(sourcePath, sourcePath + ".bak", true);
var process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = $"/c \"timeout 1 /nobreak & copy /y \"{targetPath}\" \"{targetPath}.bak\" & copy /y \"{sourcePath}\" \"{targetPath}\" & del \"{sourcePath}\" & echo Completed & pause\"";
Expand Down

0 comments on commit bfb7300

Please sign in to comment.