Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip helper adds directories #1525

Merged
merged 4 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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