Skip to content

Commit 9651d08

Browse files
committed
Drop unnecessary workingDirectory parameter
1 parent d83dadf commit 9651d08

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

Sources/DocUploadBundle/DocUploadBundle.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,7 @@ public struct DocUploadBundle {
110110
let metadataURL = URL(fileURLWithPath: "\(workDir)/metadata.json")
111111
try JSONEncoder().encode(metadata).write(to: metadataURL)
112112

113-
switch method {
114-
case .library, .zipTool(workingDirectory: .some(_)):
115-
try Zipper.zip(paths: [metadataURL, URL(fileURLWithPath: sourcePath)], to: archiveURL, method: method)
116-
117-
case .zipTool(.none):
118-
// By default, run the zip tool in the working directory
119-
try Zipper.zip(paths: [metadataURL, URL(fileURLWithPath: sourcePath)], to: archiveURL, method: .zipTool(workingDirectory: workDir))
120-
}
113+
try Zipper.zip(paths: [metadataURL, URL(fileURLWithPath: sourcePath)], to: archiveURL, method: method)
121114

122115
return archiveURL.path
123116
}

Sources/DocUploadBundle/Zipper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public enum Zipper {
7777

7878
public enum Method {
7979
case library
80-
case zipTool(workingDirectory: String? = nil)
80+
case zipTool
8181
}
8282

8383
public enum Error: Swift.Error {

Tests/DocUploadBundleTests/ZipTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ final class ZipTests: XCTestCase {
117117
try "c".write(to: fileC, atomically: true, encoding: .utf8)
118118

119119
let zipFile = tempURL.appendingPathComponent("out.zip")
120-
try Zipper.zip(paths: [fileA, subdir], to: zipFile, method: .zipTool(workingDirectory: tempDir))
120+
try Zipper.zip(paths: [fileA, subdir], to: zipFile, method: .zipTool)
121121
XCTAssert(FileManager.default.fileExists(atPath: zipFile.path))
122122

123123
do { // unzip what we zipped and check results
@@ -161,7 +161,7 @@ final class ZipTests: XCTestCase {
161161

162162
// MUT
163163
let zipFile = tempURL.appendingPathComponent("out.zip")
164-
try Zipper.zip(paths: [metadataURL, sourceURL], to: zipFile, method: .zipTool(workingDirectory: tempDir))
164+
try Zipper.zip(paths: [metadataURL, sourceURL], to: zipFile, method: .zipTool)
165165

166166
do { // validate
167167
let unzipDir = tempURL.appendingPathComponent("unzip")

0 commit comments

Comments
 (0)