Skip to content

Commit

Permalink
[xa-prep-tasks] DownloadUri needs to create directory (#884)
Browse files Browse the repository at this point in the history
Context: commit e5cc9e2

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
  • Loading branch information
jonathanpeppers authored and jonpryor committed Sep 21, 2017
1 parent 0921d41 commit 54a7b6b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 54a7b6b

Please sign in to comment.