Skip to content

Commit

Permalink
Zip helper adds directories (#1525)
Browse files Browse the repository at this point in the history
* Zip helper adds directories

* ZipHelpSpec rm obsolete comment

---------

Co-authored-by: Muki Seiler <[email protected]>
  • Loading branch information
tsurovec and muuki88 authored Feb 13, 2023
1 parent 79ccdf6 commit 3561d0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,19 @@ object ZipHelper {
val outputDir = outputFile.getParentFile
IO createDirectory outputDir
withZipOutput(outputFile) { output =>
for (FileMapping(file, name, mode) <- sources; if !file.isDirectory) {
for (FileMapping(file, name, mode) <- sources) {
val entry = new ZipArchiveEntry(file, normalizePath(name))
// Now check to see if we have permissions for this sucker.
mode foreach (entry.setUnixMode)
output putArchiveEntry entry
val fis = new java.io.FileInputStream(file)
try try
// TODO - Write file into output?
IOUtils.copy(fis, output)
finally output.closeArchiveEntry()
finally fis.close()

try if (file.isFile) {
val fis = new java.io.FileInputStream(file)
try
// TODO - Write file into output?
IOUtils.copy(fis, output)
finally fis.close()
} finally output.closeArchiveEntry()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class ZipHelperSpec extends WordSpec with Matchers with BeforeAndAfterEach with
zipSingleFile(ZipHelper.zip)
}

// ignores empty directories
"create a zip with nested directories" taggedAs (LinuxTag, WindowsTag) ignore {
"create a zip with nested directories" taggedAs (LinuxTag, WindowsTag) in {
zipNestedFile(ZipHelper.zip)
}

Expand Down

0 comments on commit 3561d0b

Please sign in to comment.