Skip to content

Commit

Permalink
devonfw#799: fixing copying from ZIP to filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille committed Dec 5, 2024
1 parent ca234a5 commit 4769719
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ private void copyRecursive(Path source, Path target, FileCopyMode mode) throws I
Iterator<Path> iterator = childStream.iterator();
while (iterator.hasNext()) {
Path child = iterator.next();
copyRecursive(child, target.resolve(child.getFileName()), mode);
copyRecursive(child, target.resolve(child.getFileName().toString()), mode);
}
}
} else if (Files.exists(source)) {
Expand Down Expand Up @@ -622,16 +622,13 @@ public void extractZip(Path file, Path targetDir) {
//FileInputStream fis = new FileInputStream(file.toFile()); ZipInputStream zis = new ZipInputStream(fis); IdeProgressBar pb = getProgressbarForUnpacking(getFileSize(file))
) {
for (Path root : fs.getRootDirectories()) {
Path filename = root.getFileName();
if (filename == null) {
Iterator<Path> iterator = Files.list(root).iterator();
try (Stream<Path> list = Files.list(root)) {
Iterator<Path> iterator = list.iterator();
while (iterator.hasNext()) {
Path child = iterator.next();
String fileName = child.getFileName().toString();
copy(child, targetDir.resolve(fileName), FileCopyMode.COPY_TREE_CONTENT);
}
} else {
copy(root, targetDir.resolve(filename), FileCopyMode.COPY_TREE_CONTENT);
}
}
} catch (IOException e) {
Expand Down

0 comments on commit 4769719

Please sign in to comment.