Fix broken updating

This commit is contained in:
Timothy Baldridge 2020-03-27 22:33:26 -06:00
parent 21189fd8e8
commit c130106213
10 changed files with 27 additions and 14 deletions

View File

@ -65,7 +65,7 @@ namespace Compression.BSA.Test
{
var filename = await DownloadMod(game, modid);
var folder = _bsaFolder.Combine(game.ToString(), modid.ToString());
folder.DeleteDirectory();
await folder.DeleteDirectory();
folder.CreateDirectory();
await FileExtractor.ExtractAll(Queue, filename, folder);
@ -73,7 +73,7 @@ namespace Compression.BSA.Test
{
TestContext.WriteLine($"From {bsa}");
TestContext.WriteLine("Cleaning Output Dir");
_tempDir.DeleteDirectory();
await _tempDir.DeleteDirectory();
_tempDir.CreateDirectory();
TestContext.WriteLine($"Reading {bsa}");

View File

@ -132,11 +132,11 @@ namespace Wabbajack.Common
public bool IsFile => File.Exists(_path);
public bool IsDirectory => Directory.Exists(_path);
public void DeleteDirectory()
public async Task DeleteDirectory()
{
if (IsDirectory)
{
Utils.DeleteDirectory(this);
await Utils.DeleteDirectory(this);
}
}

View File

@ -34,7 +34,7 @@ namespace Wabbajack.Common
{
if (DeleteAfter && Dir.Exists)
{
Utils.DeleteDirectory(Dir);
Utils.DeleteDirectory(Dir).Wait();
}
}
}

View File

@ -968,7 +968,7 @@ namespace Wabbajack.Common
/// delete a folder. If you don't like this code, it's unlikely to change without a ton of testing.
/// </summary>
/// <param name="path"></param>
public static async void DeleteDirectory(AbsolutePath path)
public static async Task DeleteDirectory(AbsolutePath path)
{
var process = new ProcessHelper
{

View File

@ -364,10 +364,14 @@ namespace Wabbajack.Lib
try
{
OutputFolder.EnumerateDirectories(true)
var toDelete = OutputFolder.EnumerateDirectories(true)
.Where(p => !expectedFolders.Contains(p))
.OrderByDescending(p => p.Size)
.Do(Utils.DeleteDirectory);
.OrderByDescending(p => ((string)p).Length)
.ToList();
foreach (var dir in toDelete)
{
await dir.DeleteDirectory();
}
}
catch (Exception)
{

View File

@ -152,7 +152,7 @@ namespace Wabbajack.Lib
if (cancel.IsCancellationRequested) return false;
UpdateTracker.NextStep("Cleaning output folder");
ModListOutputFolder.DeleteDirectory();
await ModListOutputFolder.DeleteDirectory();
if (cancel.IsCancellationRequested) return false;
UpdateTracker.NextStep("Inferring metas for game file downloads");

View File

@ -276,7 +276,7 @@ namespace Wabbajack.Lib
if (bsaDir.Exists)
{
Info($"Removing temp folder {Consts.BSACreationDir}");
Utils.DeleteDirectory(bsaDir);
await Utils.DeleteDirectory(bsaDir);
}
}

View File

@ -111,7 +111,7 @@ namespace Wabbajack.Lib
if (cancel.IsCancellationRequested) return false;
UpdateTracker.NextStep("Cleaning output folder");
ModListOutputFolder.DeleteDirectory();
await ModListOutputFolder.DeleteDirectory();
ModListOutputFolder.CreateDirectory();
UpdateTracker.NextStep("Finding Install Files");

View File

@ -500,7 +500,7 @@ namespace Wabbajack.Test
};
var folder = ((RelativePath)"DownloadTests").RelativeToEntryPoint();
folder.DeleteDirectory();
await folder.DeleteDirectory();
folder.CreateDirectory();
var inst = new TestInstaller(default, null, default, folder, null);

View File

@ -54,32 +54,36 @@ Global
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Release|Any CPU.ActiveCfg = Release|x64
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Release|x64.ActiveCfg = Release|x64
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Release|x64.Build.0 = Release|x64
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Debug|Any CPU.Build.0 = Debug|x64
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|Any CPU.ActiveCfg = Debug|x64
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|x64.ActiveCfg = Debug|x64
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|x64.Build.0 = Debug|x64
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Release|Any CPU.ActiveCfg = Release|x64
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Release|x64.ActiveCfg = Release|x64
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Release|x64.Build.0 = Release|x64
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|Any CPU.Build.0 = Debug|x64
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|Any CPU.ActiveCfg = Debug|x64
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|x64.ActiveCfg = Debug|x64
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|x64.Build.0 = Debug|x64
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Release|Any CPU.ActiveCfg = Release|x64
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Release|x64.ActiveCfg = Release|x64
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Release|x64.Build.0 = Release|x64
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|Any CPU.Build.0 = Debug|x64
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|Any CPU.ActiveCfg = Debug|x64
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|x64.ActiveCfg = Debug|x64
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|x64.Build.0 = Debug|x64
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Release|Any CPU.ActiveCfg = Release|x64
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Release|x64.ActiveCfg = Release|x64
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Release|x64.Build.0 = Release|x64
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|Any CPU.Build.0 = Debug|x64
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|Any CPU.ActiveCfg = Debug|x64
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|x64.ActiveCfg = Debug|x64
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|x64.Build.0 = Debug|x64
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Release|Any CPU.ActiveCfg = Release|x64
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Release|x64.ActiveCfg = Release|x64
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Release|x64.Build.0 = Release|x64
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|Any CPU.Build.0 = Debug|x64
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|x64.ActiveCfg = Debug|Any CPU
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|x64.Build.0 = Debug|Any CPU
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -98,24 +102,28 @@ Global
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Release|Any CPU.ActiveCfg = Release|x64
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Release|x64.ActiveCfg = Release|x64
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Release|x64.Build.0 = Release|x64
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Debug|Any CPU.Build.0 = Debug|x64
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|Any CPU.ActiveCfg = Debug|x64
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|x64.ActiveCfg = Debug|x64
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|x64.Build.0 = Debug|x64
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Release|Any CPU.ActiveCfg = Release|x64
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Release|x64.ActiveCfg = Release|x64
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Release|x64.Build.0 = Release|x64
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|Any CPU.Build.0 = Debug|x64
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|Any CPU.ActiveCfg = Debug|x64
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|x64.ActiveCfg = Debug|x64
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|x64.Build.0 = Debug|x64
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Release|Any CPU.ActiveCfg = Release|x64
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Release|x64.ActiveCfg = Release|x64
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Release|x64.Build.0 = Release|x64
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|Any CPU.Build.0 = Debug|x64
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|Any CPU.ActiveCfg = Debug|x64
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|x64.ActiveCfg = Debug|x64
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|x64.Build.0 = Debug|x64
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|Any CPU.ActiveCfg = Release|x64
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.ActiveCfg = Release|x64
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.Build.0 = Release|x64
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|Any CPU.Build.0 = Debug|x64
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6856DBF-C959-4867-A8A8-343DA2D2715E}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -130,6 +138,7 @@ Global
{BA8A3E49-60D2-4BA2-B285-CB09FFDB6D32}.Release|Any CPU.ActiveCfg = Release|x64
{BA8A3E49-60D2-4BA2-B285-CB09FFDB6D32}.Release|x64.ActiveCfg = Release|x64
{BA8A3E49-60D2-4BA2-B285-CB09FFDB6D32}.Release|x64.Build.0 = Release|x64
{BA8A3E49-60D2-4BA2-B285-CB09FFDB6D32}.Debug|Any CPU.Build.0 = Debug|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE