Merge pull request #885 from amosavian/master
diff --git a/Foundation/NSFileManager.swift b/Foundation/NSFileManager.swift
index 39a2880..7778abf 100644
--- a/Foundation/NSFileManager.swift
+++ b/Foundation/NSFileManager.swift
@@ -305,7 +305,7 @@
let grd = getgrgid(s.st_gid)
if grd != nil && grd!.pointee.gr_name != nil {
let name = String(cString: grd!.pointee.gr_name)
- result[.groupOwnerAccountID] = name
+ result[.groupOwnerAccountName] = name
}
var type : FileAttributeType
diff --git a/TestFoundation/TestNSFileManager.swift b/TestFoundation/TestNSFileManager.swift
index 82ad25d..8c65fc6 100644
--- a/TestFoundation/TestNSFileManager.swift
+++ b/TestFoundation/TestNSFileManager.swift
@@ -151,6 +151,23 @@
let fileOwnerAccountID = attrs[.ownerAccountID] as? NSNumber
XCTAssertNotNil(fileOwnerAccountID)
+ let fileGroupOwnerAccountID = attrs[.groupOwnerAccountID] as? NSNumber
+ XCTAssertNotNil(fileGroupOwnerAccountID)
+
+ if let fileOwnerAccountName = attrs[.ownerAccountName] {
+ XCTAssertNotNil(fileOwnerAccountName as? String)
+ if let fileOwnerAccountNameStr = fileOwnerAccountName as? String {
+ XCTAssertFalse(fileOwnerAccountNameStr.isEmpty)
+ }
+ }
+
+ if let fileGroupOwnerAccountName = attrs[.groupOwnerAccountName] {
+ XCTAssertNotNil(fileGroupOwnerAccountName as? String)
+ if let fileGroupOwnerAccountNameStr = fileGroupOwnerAccountName as? String {
+ XCTAssertFalse(fileGroupOwnerAccountNameStr.isEmpty)
+ }
+ }
+
} catch let err {
XCTFail("\(err)")
}