mirror of
https://github.com/patchzyy/wiicompiled
synced 2026-10-20 05:33:23 -04:00
fail on unusable native index without sources, create assets dir before marker delete
This commit is contained in:
@@ -41,6 +41,7 @@ internal static class DiscTool
|
||||
// time, so it has to survive past this install (see Program.cs, which points dvd_root here).
|
||||
reporter.Progress(InstallStages.ExtractDisc, "Extracting the disc image", 4);
|
||||
var dataDir = Path.Combine(assetsDirectory, "DATA");
|
||||
Directory.CreateDirectory(assetsDirectory);
|
||||
File.Delete(Path.Combine(assetsDirectory, ExtractionMarker));
|
||||
if (Directory.Exists(dataDir)) Directory.Delete(dataDir, recursive: true);
|
||||
await RunExtractAsync(nodTool, isoPath, dataDir, cancellationToken);
|
||||
|
||||
@@ -87,6 +87,9 @@ public static class RuntimeNativeIndexBuilder
|
||||
: null;
|
||||
if (RuntimeNativeIndexFile.TryLoad(indexPath, expectedDigest, out var index, out var reason))
|
||||
return index;
|
||||
if (expectedDigest is null)
|
||||
throw new InvalidOperationException(
|
||||
$"The native index {indexPath} is unusable ({reason}) and the native sources it describes are missing: {sourceRoot}");
|
||||
|
||||
diagnostics?.WriteLine($"[translator] ignoring native index {indexPath} ({reason}); scanning {sourceRoot}");
|
||||
return Build(sourceRoot);
|
||||
|
||||
@@ -149,6 +149,10 @@ public sealed class RuntimeNativeIndexTests
|
||||
AssertIndexEqual(built, RuntimeNativeIndexBuilder.Resolve(sources, indexPath, diagnostics));
|
||||
Assert.Equal("", diagnostics.ToString());
|
||||
Assert.Empty(RuntimeNativeIndexBuilder.Build(sources).Registrations);
|
||||
|
||||
File.WriteAllText(indexPath, "{}");
|
||||
Assert.Throws<InvalidOperationException>(
|
||||
() => RuntimeNativeIndexBuilder.Resolve(sources, indexPath, diagnostics));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user