Skip to content

Commit fa996e2

Browse files
author
David Pierson
committed
Added IsStreamOwner to TarArchive
1 parent 92a49f6 commit fa996e2

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/Tar/TarArchive.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
// obligated to do so. If you do not wish to do so, delete this
3434
// exception statement from your version.
3535

36+
// HISTORY
37+
// 28-01-2010 DavidPierson Added IsStreamOwner
38+
3639
using System;
3740
using System.IO;
3841
using System.Text;
@@ -470,6 +473,20 @@ public int RecordSize {
470473
}
471474
}
472475

476+
/// <summary>
477+
/// Sets the IsStreamOwner property on the underlying stream.
478+
/// Set this to false to prevent the Close of the TarArchive from closing the stream.
479+
/// </summary>
480+
public bool IsStreamOwner {
481+
set {
482+
if (tarIn != null) {
483+
tarIn.IsStreamOwner = value;
484+
} else {
485+
tarOut.IsStreamOwner = value;
486+
}
487+
}
488+
}
489+
473490
/// <summary>
474491
/// Close the archive.
475492
/// </summary>
@@ -540,7 +557,7 @@ void ExtractEntry(string destDir, TarEntry entry)
540557

541558
string name = entry.Name;
542559

543-
if (Path.IsPathRooted(name) == true) {
560+
if (Path.IsPathRooted(name)) {
544561
// NOTE:
545562
// for UNC names... \\machine\share\zoom\beet.txt gives \zoom\beet.txt
546563
name = name.Substring(Path.GetPathRoot(name).Length);

0 commit comments

Comments
 (0)