From 37818c60004a73a8a358e4bce552b2ef576ffa2f Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 1 Jul 2017 23:03:46 +0300 Subject: [PATCH] Added proper link path support to TarEntry. --- Sources/TarContainer.swift | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Sources/TarContainer.swift b/Sources/TarContainer.swift index 38940445..ed3420c3 100644 --- a/Sources/TarContainer.swift +++ b/Sources/TarContainer.swift @@ -74,6 +74,9 @@ public class TarEntry: ContainerEntry { /** Provides a dictionary with various attributes of the entry. `FileAttributeKey` values are used as dictionary keys. + + - Note: + Will be renamed to `attributes` in 4.0. */ public var entryAttributes: [FileAttributeKey: Any] @@ -152,15 +155,14 @@ public class TarEntry: ContainerEntry { /// Comment associated with the entry (PAX only). public private(set) var comment: String? - /// Path to linked entry (PAX only). - public private(set) var linkPath: String? + /// Path to a linked file. + public var linkPath: String? { + return paxLinkPath ?? linkedFileName + } - /** - Owner's group name. + private var paxLinkPath: String? - - Warning: - Deprecated and will be removed in 4.0. - */ + /// Other entries from PAX extended headers. public private(set) var unknownExtendedHeaderEntries: [String: String] = [:] fileprivate init(_ data: Data, _ index: inout Int, @@ -347,7 +349,7 @@ public class TarEntry: ContainerEntry { case "hdrcharset": break case "linkpath": - self.linkPath = value + self.paxLinkPath = value case "path": self.paxPath = value case "size":