mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
[ZIP] Add public API for accessing uid and gid
These APIs are: ZipEntryInfo.ownerID and groupID (named for consistency with TarEntryInfo).
This commit is contained in:
@@ -74,6 +74,24 @@ public struct ZipEntryInfo: ContainerEntryInfo {
|
||||
/// Entry's compression method.
|
||||
public let compressionMethod: CompressionMethod
|
||||
|
||||
/**
|
||||
ID of entry's owner.
|
||||
|
||||
Set from different sources in the following preference order, if possible:
|
||||
1. Info-ZIP New Unix extra field.
|
||||
2. Info-ZIP Unix extra field.
|
||||
*/
|
||||
public let ownerID: Int?
|
||||
|
||||
/**
|
||||
ID of the group of entry's owner.
|
||||
|
||||
Set from different sources in the following preference order, if possible:
|
||||
1. Info-ZIP New Unix extra field.
|
||||
2. Info-ZIP Unix extra field.
|
||||
*/
|
||||
public let groupID: Int?
|
||||
|
||||
let cdEntry: ZipCentralDirectoryEntry
|
||||
let localHeader: ZipLocalHeader
|
||||
|
||||
@@ -174,6 +192,12 @@ public struct ZipEntryInfo: ContainerEntryInfo {
|
||||
|
||||
// Compression method.
|
||||
self.compressionMethod = CompressionMethod(localHeader.compressionMethod)
|
||||
|
||||
// Owner's ID.
|
||||
self.ownerID = localHeader.infoZipNewUid ?? localHeader.infoZipUid?.toInt()
|
||||
|
||||
// Owner's group ID.
|
||||
self.groupID = localHeader.infoZipNewGid ?? localHeader.infoZipGid?.toInt()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user