mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
Fix test failures for multi-threading support in file-based Zips
- Fix build errors in Tar tests by adding !NETFRAMEWORK condition to #if LINUX - Fix split archive test failures by checking ss.Files.Count == 1 before opening independent file streams - The multi-threading feature now correctly only applies to single-file ZIP archives, not split/multi-volume archives Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
This commit is contained in:
@@ -32,19 +32,17 @@ internal class SeekableZipFilePart : ZipFilePart
|
||||
|
||||
protected override Stream CreateBaseStream()
|
||||
{
|
||||
if (BaseStream is SourceStream ss)
|
||||
if (BaseStream is SourceStream ss && ss.IsFileMode && ss.Files.Count == 1)
|
||||
{
|
||||
if (ss.IsFileMode)
|
||||
{
|
||||
var fileStream = ss.CurrentFile.OpenRead();
|
||||
fileStream.Position = Header.DataStartPosition.NotNull();
|
||||
return fileStream;
|
||||
}
|
||||
var fileStream = ss.CurrentFile.OpenRead();
|
||||
fileStream.Position = Header.DataStartPosition.NotNull();
|
||||
return fileStream;
|
||||
}
|
||||
BaseStream.Position = Header.DataStartPosition.NotNull();
|
||||
|
||||
return BaseStream;
|
||||
}
|
||||
|
||||
public override bool SupportsMultiThreading => BaseStream is SourceStream ss && ss.IsFileMode;
|
||||
public override bool SupportsMultiThreading =>
|
||||
BaseStream is SourceStream ss && ss.IsFileMode && ss.Files.Count == 1;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public class TarReaderAsyncTests : ReaderTests
|
||||
Assert.Throws<IncompleteArchiveException>(() => reader.MoveToNextEntry());
|
||||
}
|
||||
|
||||
#if LINUX
|
||||
#if LINUX && !NETFRAMEWORK
|
||||
[Fact]
|
||||
public async Task Tar_GZip_With_Symlink_Entries_Async()
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ public class TarReaderTests : ReaderTests
|
||||
Assert.Throws<IncompleteArchiveException>(() => reader.MoveToNextEntry());
|
||||
}
|
||||
|
||||
#if LINUX
|
||||
#if LINUX && !NETFRAMEWORK
|
||||
[Fact]
|
||||
public void Tar_GZip_With_Symlink_Entries()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user