mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
Add a/c/m times to ContainerEntryInfo protocol.
This also adds accessTime from NTFS extra field in ZipEntryInfo
This commit is contained in:
@@ -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?
|
||||
|
||||
}
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user