From 2e40dc903a663fb2bb2162baf19961bf5ceaad26 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 7 Jul 2018 16:52:10 +0300 Subject: [PATCH] [TAR] Add fileTypeIndicator property to TAR's ContainerEntryType extension --- Sources/TAR/ContainerEntryType+Tar.swift | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Sources/TAR/ContainerEntryType+Tar.swift b/Sources/TAR/ContainerEntryType+Tar.swift index 5c42688b..552ffe74 100644 --- a/Sources/TAR/ContainerEntryType+Tar.swift +++ b/Sources/TAR/ContainerEntryType+Tar.swift @@ -30,4 +30,29 @@ extension ContainerEntryType { } } + var fileTypeIndicator: UInt8 { + switch self { + case .regular: + return 48 + case .hardLink: + return 49 + case .symbolicLink: + return 50 + case .characterSpecial: + return 51 + case .blockSpecial: + return 52 + case .directory: + return 53 + case .fifo: + return 54 + case .contiguous: + return 55 + case .socket: + return 0 + case .unknown: + return 0 + } + } + }