1212//
1313//===----------------------------------------------------------------------===//
1414
15- import struct Foundation. Data
16-
1715// This file defines a basic tar writer which produces POSIX tar files.
1816// This avoids the need to depend on a system-provided tar binary.
1917//
@@ -92,7 +90,7 @@ func octal6(_ value: Int) -> String {
9290 // which causes it to return an empty string from time to time when running the tests
9391 // in parallel using swift-testing: https://github.com/swiftlang/swift-corelibs-foundation/issues/5152
9492 let str = String ( value, radix: 8 )
95- return String ( repeating: " 0 " , count: 6 - str. count) . appending ( str)
93+ return String ( repeating: " 0 " , count: 6 - str. count) + str
9694}
9795
9896/// Serializes an integer to an 11 character octal representation.
@@ -105,7 +103,7 @@ func octal11(_ value: Int) -> String {
105103 // which causes it to return an empty string from time to time when running the tests
106104 // in parallel using swift-testing: https://github.com/swiftlang/swift-corelibs-foundation/issues/5152
107105 let str = String ( value, radix: 8 )
108- return String ( repeating: " 0 " , count: 11 - str. count) . appending ( str)
106+ return String ( repeating: " 0 " , count: 11 - str. count) + str
109107}
110108
111109// These ranges define the offsets of the standard fields in a Tar header.
@@ -343,16 +341,6 @@ public func tar(_ bytes: [UInt8], filename: String = "app") throws -> [UInt8] {
343341 return archive
344342}
345343
346- /// Creates a tar archive containing a single file
347- /// - Parameters:
348- /// - data: The file's body data
349- /// - filename: The file's name in the archive
350- /// - Returns: A tar archive containing the file
351- /// - Throws: If the filename is invalid
352- public func tar( _ data: Data , filename: String ) throws -> [ UInt8 ] {
353- try tar ( [ UInt8] ( data) , filename: filename)
354- }
355-
356344/// Represents a tar archive
357345public struct Archive {
358346 /// The files, directories and other members of the archive
0 commit comments