From cb09837e0b092a32b08ebac5a62874a229428e75 Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Wed, 4 May 2016 13:57:28 +0200 Subject: [PATCH] File.Move doesn't overwrite targets 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 --- .../UnzipDirectoryChildren.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/UnzipDirectoryChildren.cs b/src/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/UnzipDirectoryChildren.cs index cd0f33eeebd..754e3422748 100644 --- a/src/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/UnzipDirectoryChildren.cs +++ b/src/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/UnzipDirectoryChildren.cs @@ -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); + } } } }