12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
- import struct Foundation. Data
16
-
17
15
// This file defines a basic tar writer which produces POSIX tar files.
18
16
// This avoids the need to depend on a system-provided tar binary.
19
17
//
@@ -92,7 +90,7 @@ func octal6(_ value: Int) -> String {
92
90
// which causes it to return an empty string from time to time when running the tests
93
91
// in parallel using swift-testing: https://github.com/swiftlang/swift-corelibs-foundation/issues/5152
94
92
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
96
94
}
97
95
98
96
/// Serializes an integer to an 11 character octal representation.
@@ -105,7 +103,7 @@ func octal11(_ value: Int) -> String {
105
103
// which causes it to return an empty string from time to time when running the tests
106
104
// in parallel using swift-testing: https://github.com/swiftlang/swift-corelibs-foundation/issues/5152
107
105
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
109
107
}
110
108
111
109
// 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] {
343
341
return archive
344
342
}
345
343
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
-
356
344
/// Represents a tar archive
357
345
public struct Archive {
358
346
/// The files, directories and other members of the archive
0 commit comments