diff --git a/NBitcoin.TestFramework/NBitcoin.TestFramework.csproj b/NBitcoin.TestFramework/NBitcoin.TestFramework.csproj index c6944c131b..72415601c9 100644 --- a/NBitcoin.TestFramework/NBitcoin.TestFramework.csproj +++ b/NBitcoin.TestFramework/NBitcoin.TestFramework.csproj @@ -27,6 +27,7 @@ + diff --git a/NBitcoin.TestFramework/NodeBuilder.cs b/NBitcoin.TestFramework/NodeBuilder.cs index 160cddd37e..3c56781970 100644 --- a/NBitcoin.TestFramework/NodeBuilder.cs +++ b/NBitcoin.TestFramework/NodeBuilder.cs @@ -161,7 +161,18 @@ public static string EnsureDownloaded(NodeDownloadData downloadData) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - ZipFile.ExtractToDirectory(zip, extractDirectory); + // From https://feedback.telerik.com/document-processing/1518667-ziplibrary-allow-zipfile-extracttodirectory-to-overwrite-existing-files-when-extract-zip + + using var source = ZipFile.Open(zip, ZipArchiveMode.Read, null); + foreach (var entry in source.Entries) + { + var fullPath = Path.GetFullPath(Path.Combine(extractDirectory, entry.FullName)); + + if (Path.GetFileName(fullPath).Length == 0) continue; + Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); + // The boolean parameter determines whether an existing file that has the same name as the destination file should be overwritten + entry.ExtractToFile(fullPath, true); + } } else {