mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Extractor fixes for broken Lucian introspection
This commit is contained in:
@ -40,6 +40,12 @@ namespace Wabbajack.Common
|
|||||||
}
|
}
|
||||||
this.DeleteAfter = deleteAfter;
|
this.DeleteAfter = deleteAfter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TempFile(Extension ext)
|
||||||
|
:this(new FileInfo((string)GetTempFilePath().WithExtension(ext)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public async ValueTask DisposeAsync()
|
public async ValueTask DisposeAsync()
|
||||||
{
|
{
|
||||||
if (DeleteAfter && Path.Exists)
|
if (DeleteAfter && Path.Exists)
|
||||||
|
@ -224,7 +224,7 @@ namespace Wabbajack.VirtualFileSystem.Test
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static AbsolutePath _stagingFolder = ((RelativePath)"NexusDownloads").RelativeToEntryPoint();
|
public static AbsolutePath StagingFolder = ((RelativePath)"NexusDownloads").RelativeToEntryPoint();
|
||||||
|
|
||||||
private static async Task<AbsolutePath> DownloadMod(Game game, int mod)
|
private static async Task<AbsolutePath> DownloadMod(Game game, int mod)
|
||||||
{
|
{
|
||||||
@ -235,9 +235,9 @@ namespace Wabbajack.VirtualFileSystem.Test
|
|||||||
return await DownloadNexusFile(game, mod, file);
|
return await DownloadNexusFile(game, mod, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<AbsolutePath> DownloadNexusFile(Game game, int mod, NexusFileInfo file)
|
public static async Task<AbsolutePath> DownloadNexusFile(Game game, int mod, NexusFileInfo file)
|
||||||
{
|
{
|
||||||
var src = _stagingFolder.Combine(file.file_name);
|
var src = StagingFolder.Combine(file.file_name);
|
||||||
|
|
||||||
if (src.Exists) return src;
|
if (src.Exists) return src;
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ namespace Wabbajack.VirtualFileSystem.Test
|
|||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<AbsolutePath> DownloadMod(Game game, int mod, int fileId)
|
public static async Task<AbsolutePath> DownloadMod(Game game, int mod, int fileId)
|
||||||
{
|
{
|
||||||
using var client = await NexusApiClient.Get();
|
using var client = await NexusApiClient.Get();
|
||||||
var results = await client.GetModFiles(game, mod);
|
var results = await client.GetModFiles(game, mod);
|
||||||
|
@ -5,6 +5,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
using Wabbajack.Lib;
|
||||||
|
using Wabbajack.Lib.Downloaders;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
@ -186,6 +188,22 @@ namespace Wabbajack.VirtualFileSystem.Test
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(Game.SkyrimSpecialEdition, 20035, 130759)] // Lucian
|
||||||
|
public async Task CanAnalyzeMods(Game game, int modid, int fileId)
|
||||||
|
{
|
||||||
|
await using var tmpFolder = await TempFolder.Create();
|
||||||
|
|
||||||
|
var path = await FileExtractorTests.DownloadMod(game, modid, fileId);
|
||||||
|
await path.CopyToAsync(path.FileName.RelativeTo(tmpFolder.Dir));
|
||||||
|
|
||||||
|
var context = new Context(Queue);
|
||||||
|
await context.AddRoot(tmpFolder.Dir);
|
||||||
|
|
||||||
|
Assert.True(context.Index.ByFullPath.Count >= 3);
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task AddFile(AbsolutePath filename, string text)
|
private static async Task AddFile(AbsolutePath filename, string text)
|
||||||
{
|
{
|
||||||
filename.Parent.CreateDirectory();
|
filename.Parent.CreateDirectory();
|
||||||
|
@ -199,6 +199,7 @@ namespace Wabbajack.VirtualFileSystem
|
|||||||
.WithExtension(source.Extension));
|
.WithExtension(source.Extension));
|
||||||
await using var s = await sf.GetStream();
|
await using var s = await sf.GetStream();
|
||||||
await spoolFile.Path.WriteAllAsync(s);
|
await spoolFile.Path.WriteAllAsync(s);
|
||||||
|
source = spoolFile.Path;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.Log(new GenericInfo($"Extracting {(string)source.FileName}",
|
Utils.Log(new GenericInfo($"Extracting {(string)source.FileName}",
|
||||||
|
Reference in New Issue
Block a user