HTTPDownloader creates directory for its destination

This commit is contained in:
Justin Swanson 2019-12-01 15:26:11 -06:00
parent 5ba0514a0e
commit 4965f78c07

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
@ -95,7 +96,6 @@ namespace Wabbajack.Lib.Downloaders
{
}
;
if (stream.IsFaulted || response.StatusCode != HttpStatusCode.OK)
{
Utils.Log($"While downloading {Url} - {stream.Exception.ExceptionToString()}");
@ -111,6 +111,7 @@ namespace Wabbajack.Lib.Downloaders
var contentSize = headerVar != null ? long.Parse(headerVar) : 1;
Directory.CreateDirectory(Path.GetDirectoryName(destination));
using (var webs = stream.Result)
using (var fs = File.OpenWrite(destination))