This is a source archive of the MoltenVK project from github, which is my use-case for SharpCompress. I added a test case in the project, which should extract the tar, and validate any symlink targets with what the tar thinks it ought to be.
This commit is contained in:
parent
192b9c1e8b
commit
d91e58f2cc
2 changed files with 37 additions and 0 deletions
|
|
@ -186,5 +186,42 @@ namespace SharpCompress.Test.Tar
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tar_GZip_With_Symlink_Entries()
|
||||
{
|
||||
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "TarWithSymlink.tar.gz")))
|
||||
using (var reader = TarReader.Open(stream))
|
||||
{
|
||||
List<string> names = new List<string>();
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (reader.Entry.IsDirectory)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH,
|
||||
new ExtractionOptions()
|
||||
{
|
||||
ExtractFullPath = true,
|
||||
Overwrite = true
|
||||
});
|
||||
if (reader.Entry.LinkTarget != null)
|
||||
{
|
||||
#if NETSTANDARD2_0
|
||||
var link = new Mono.Unix.UnixSymbolicLinkInfo(reader.Entry.Key);
|
||||
if (link.HasContents)
|
||||
{
|
||||
Assert.Equal(link.GetContents(), reader.Entry.LinkTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.True(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
tests/TestArchives/Archives/TarWithSymlink.tar.gz
Normal file
BIN
tests/TestArchives/Archives/TarWithSymlink.tar.gz
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue