Add a/c/m times to ContainerEntryInfo protocol.

This also adds accessTime from NTFS extra field in ZipEntryInfo
This commit is contained in:
Timofey Solomko
2017-10-23 20:13:40 +03:00
parent d6c265c8e1
commit a22a05fedc
4 changed files with 25 additions and 17 deletions
+2 -2
View File
@@ -18,8 +18,6 @@ public struct SevenZipEntryInfo: ContainerEntryInfo {
public let type: ContainerEntryType
// MARK: 7-Zip specific
/// Entry's last access time and date.
public let accessTime: Date?
@@ -29,6 +27,8 @@ public struct SevenZipEntryInfo: ContainerEntryInfo {
/// Entry's last modification time and date.
public let modificationTime: Date?
// MARK: 7-Zip specific
/// 7-Zip internal property which may contain UNIX permissions, type and/or DOS attributes.
public let winAttributes: UInt32?
@@ -13,7 +13,12 @@ public protocol ContainerEntryInfo {
var size: Int? { get }
// TODO: a/c/m times.
var accessTime: Date? { get }
var creationTime: Date? { get }
var modificationTime: Date? { get }
// TODO: uncompressed and compressed sizes?
}
+9 -9
View File
@@ -18,18 +18,18 @@ public struct TarEntryInfo: ContainerEntryInfo {
public let type: ContainerEntryType
/// The most recent access time of the original file or directory (PAX only).
public let accessTime: Date?
/// The creation time of the original file or directory (PAX only).
public let creationTime: Date?
/// The most recent modification time of the original file or directory.
public let modificationTime: Date?
// MARK: TAR specific
public let permissions: Permissions
/// The most recent access time of the original file or directory (PAX only).
public let accessTime: Date?
/// The most recent modification time of the original file or directory.
public let modificationTime: Date
/// The creation time of the original file or directory (PAX only).
public let creationTime: Date?
/// Owner's ID.
public let ownerID: Int?
+8 -5
View File
@@ -19,13 +19,15 @@ public struct ZipEntryInfo: ContainerEntryInfo {
public let type: ContainerEntryType
// MARK: ZIP specific
// TODO: Describe preference of various fields when setting this property.
public let modificationTime: Date?
// TODO: Describe preference of various fields when setting time properties.
public let accessTime: Date?
public let creationTime: Date?
public let modificationTime: Date?
// MARK: ZIP specific
public let comment: String
public let externalFileAttributes: UInt32
@@ -72,8 +74,9 @@ public struct ZipEntryInfo: ContainerEntryInfo {
hour: hours, minute: minutes, second: seconds).date
}
// NTFS Creation Time from extra fields.
// NTFS Access and Creation times from extra fields.
self.creationTime = Date(from: cdEntry.ntfsCtime)
self.accessTime = Date(from: cdEntry.ntfsAtime)
// Size
self.size = Int(cdEntry.uncompSize)