Skip to content

Commit adacddc

Browse files
sadovnikovkrosenvold
authored andcommitted
PLXCOMP-153, PLXCOMP-205. Adding support for includes/excludes to TarUnArchiver
Author: Viktor Sadovnikov <[email protected]> Adapted to master branch by Kristian Rosenvold
1 parent 00a4f5b commit adacddc

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/main/java/org/codehaus/plexus/archiver/tar/TarUnArchiver.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,22 @@ protected void execute()
8585
try
8686
{
8787
getLogger().info( "Expanding: " + getSourceFile() + " into " + getDestDirectory() );
88-
tis = new TarArchiveInputStream( compression.decompress( getSourceFile(),
88+
File sourceFile = getSourceFile();
89+
TarFile tarFile = new TarFile( sourceFile );
90+
tis = new TarArchiveInputStream( compression.decompress( sourceFile,
8991
new BufferedInputStream(
90-
new FileInputStream( getSourceFile() ) ) ) );
92+
new FileInputStream( sourceFile ) ) ) );
9193
TarArchiveEntry te;
92-
9394
while ( ( te = tis.getNextTarEntry() ) != null )
9495
{
95-
extractFile( getSourceFile(), getDestDirectory(), tis, te.getName(), te.getModTime(),
96-
te.isDirectory(), te.getMode() != 0 ? te.getMode() : null);
96+
97+
TarResource fileInfo = new TarResource( tarFile, te);
98+
if (!isSelected( te.getName(), fileInfo )) {
99+
continue;
100+
}
101+
102+
extractFile(getSourceFile(), getDestDirectory(), tis, te.getName(), te.getModTime(),
103+
te.isDirectory(), te.getMode() != 0 ? te.getMode() : null);
97104
}
98105
getLogger().debug( "expand complete" );
99106

0 commit comments

Comments
 (0)