Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Sources/Basics/Archiver/ZipArchiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public struct ZipArchiver: Archiver, Cancellable {
arguments: [
"/bin/sh",
"-c",
"cd \(directory.parentDirectory.underlying.pathString) && zip -r \(destinationPath.pathString) \(directory.basename)",
"cd \(directory.parentDirectory.underlying.pathString) && zip -ry \(destinationPath.pathString) \(directory.basename)",
]
)
#endif
Expand Down
8 changes: 8 additions & 0 deletions Tests/BasicsTests/Archiver/ZipArchiverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ final class ZipArchiverTests: XCTestCase {
try localFileSystem.writeFileContents(dir2.appending("file3.txt"), string: "Hello World 3!")
try localFileSystem.writeFileContents(dir2.appending("file4.txt"), string: "Hello World 4!")

try localFileSystem.createSymbolicLink(rootDir.appending("file2.txt"), pointingAt: dir1.appending("file2.txt"), relative: true)

let archivePath = tmpdir.appending(component: UUID().uuidString + ".zip")
try await archiver.compress(directory: rootDir, to: archivePath)
XCTAssertFileExists(archivePath)
Expand Down Expand Up @@ -154,6 +156,12 @@ final class ZipArchiverTests: XCTestCase {
try? localFileSystem.readFileContents(extractedDir2.appending("file4.txt")),
"Hello World 4!"
)

XCTAssertTrue(localFileSystem.isSymlink(extractRootDir.appending("file2.txt")))
XCTAssertEqual(
try? localFileSystem.readFileContents(extractRootDir.appending("file2.txt")),
try? localFileSystem.readFileContents(extractedDir1.appending("file2.txt"))
)
}
}
}