Refactor ArchiveWriter to expose archiving each URL independently#693
Refactor ArchiveWriter to expose archiving each URL independently#693JaewonHur wants to merge 4 commits intoapple:mainfrom
Conversation
This archiveURLs API is used to selectively archive the objects under the given URLs.
| let err = POSIXErrorCode(rawValue: errNo) ?? .EINVAL | ||
| throw ArchiveError.failedToCreateArchive("lstat failed for '\(fullPath)': \(POSIXError(err))") | ||
| } | ||
| public func archiveURLs(_ urls: [URL], base: URL) throws { |
There was a problem hiding this comment.
I really do not want the path type (URL) to be in the name. Maybe archivePaths, or even just archive? We can rely on overloading to support an array of FilePaths in the future for either version.
There was a problem hiding this comment.
archive(_ paths: [FilePath], base: FilePath) gets my vote.
For container 1.0 we'll be banishing URL wherever possible.
There was a problem hiding this comment.
I'm okay with going to FilePath here to start.
There was a problem hiding this comment.
Updated to use archive(_ paths: [FilePath], base: FilePath).
It feels somewhat weird as archive(_ paths: [FilePath],...) needs full paths, while archive(_ relativePath: FilePath,...) needs a relative path, but leave for now.
I can surely update if you want!
|
@JaewonHur How much overlap is there with #652? |
This PR refactors
ArchiveWriterto add an APIarchiveURLs. ThisarchiveURLsis used to archive the contents at each URL independently, similar to doingtar -cvf archive.tar foo.bin /bar/baz.txt.