From 64e601f1e1ab3ff81437c99bbfebfb536f8fcabc Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Thu, 21 Sep 2017 11:15:00 -0500 Subject: [PATCH] [xa-prep-tasks] `DownloadUri` needs to create directory Context in #880 Since we are now downloading the bundle to `~/android-archives`, it is possible that the directory will not exist on a clean machine. We should be calling `Directory.CreateDirectory` in the `DownloadUri` task anyway, as this could easily happen on any destination file. A case this occured happened on VSTS: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=1006149 --- .../Xamarin.Android.BuildTools.PrepTasks/DownloadUri.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/DownloadUri.cs b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/DownloadUri.cs index 1f3aee8599b..567510ef314 100644 --- a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/DownloadUri.cs +++ b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/DownloadUri.cs @@ -58,9 +58,10 @@ async TTask DownloadFile (HttpClient client, string uri, string destinationFile) Log.LogMessage (MessageImportance.Normal, $"Skipping uri '{uri}' as destination file already exists '{destinationFile}'."); return; } - var dp = Path.GetDirectoryName (destinationFile); - var dn = Path.GetFileName (destinationFile); - var tempPath = Path.Combine (dp, "." + dn + ".download"); + var dp = Path.GetDirectoryName (destinationFile); + var dn = Path.GetFileName (destinationFile); + var tempPath = Path.Combine (dp, "." + dn + ".download"); + Directory.CreateDirectory(dp); Log.LogMessage (MessageImportance.Normal, $"Downloading `{uri}` to `{tempPath}`."); try {