Skip to content

Commit

Permalink
File.Move doesn't overwrite targets
Browse files Browse the repository at this point in the history
File.Move will throw an exception whenever the target file exists.
Assuming that the task should overwrite the existing target files
for smooth operation, this change checks whether the target file
exists and, if so, deletes it prior to calling File.Move
  • Loading branch information
grendello committed May 4, 2016
1 parent da0cc06 commit cb09837
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ async TTask ExtractFile (string tempDir, string sourceFile, string relativeDestD
Log.LogMessage (MessageImportance.Low, $"mv '{fse}' '{dest}'");
if (Directory.Exists (fse))
Process.Start ("/bin/mv", $@"""{fse}"" ""{dest}""").WaitForExit ();
else
else {
if (File.Exists (dest))
File.Delete (dest);
File.Move (fse, dest);
}
}
}
}
Expand Down

0 comments on commit cb09837

Please sign in to comment.