Skip to content

Commit

Permalink
Merge pull request #254 from dirb/fix-245
Browse files Browse the repository at this point in the history
Not ignore fullpath on tarfileset
  • Loading branch information
tcurdt authored Feb 25, 2017
2 parents a42c15f + 656c772 commit 110fe8f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/org/vafer/jdeb/producers/DataProducerFileSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void produce( final DataConsumer pReceiver ) throws IOException {
int filemode = TarEntry.DEFAULT_FILE_MODE;
int dirmode = TarEntry.DEFAULT_DIR_MODE;
String prefix = "";
String fullpath = "";

if (fileset instanceof Tar.TarFileSet) {
Tar.TarFileSet tarfileset = (Tar.TarFileSet) fileset;
Expand All @@ -60,13 +61,20 @@ public void produce( final DataConsumer pReceiver ) throws IOException {
filemode = tarfileset.getMode();
dirmode = tarfileset.getDirMode(tarfileset.getProject());
prefix = tarfileset.getPrefix(tarfileset.getProject());
fullpath = tarfileset.getFullpath();
}

final DirectoryScanner scanner = fileset.getDirectoryScanner(fileset.getProject());
scanner.scan();

final File basedir = scanner.getBasedir();

if (scanner.getIncludedFilesCount() != 1 || scanner.getIncludedDirsCount() != 0) {
// the full path attribute only have sense in this context
// if it's a single-file fileset, we ignore it otherwise
fullpath = "";
}

for (String directory : scanner.getIncludedDirectories()) {
String name = directory.replace('\\', '/');

Expand All @@ -86,7 +94,7 @@ public void produce( final DataConsumer pReceiver ) throws IOException {

final InputStream inputStream = new FileInputStream(file);
try {
final String entryName = prefix + "/" + name;
final String entryName = "".equals(fullpath) ? prefix + "/" + name : fullpath;

final File entryPath = new File(entryName);

Expand Down

0 comments on commit 110fe8f

Please sign in to comment.