From dcabef6e95eed8a2287fce9617c3708354d63f05 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Fri, 6 Jul 2018 21:09:45 +0300 Subject: [PATCH] [TAR] Add basic public initializer to TarEntryInfo It takes two the most necessary properties of EntryInfo as arguments: name and type. --- Sources/TAR/TarEntryInfo.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/TAR/TarEntryInfo.swift b/Sources/TAR/TarEntryInfo.swift index 5009f2a1..e1de9da7 100644 --- a/Sources/TAR/TarEntryInfo.swift +++ b/Sources/TAR/TarEntryInfo.swift @@ -98,6 +98,15 @@ public struct TarEntryInfo: ContainerEntryInfo { let blockStartIndex: Int + public init(name: String, type: ContainerEntryType) { + self.name = name + self.type = type + self.linkName = "" + // These properties are only used when entry is loaded from the container. + self.format = .pax + self.blockStartIndex = 0 + } + init(_ byteReader: ByteReader, _ global: TarExtendedHeader?, _ local: TarExtendedHeader?, _ longName: String?, _ longLinkName: String?) throws { self.blockStartIndex = byteReader.offset