Skip to content

Commit 0cbb322

Browse files
authored
Merge pull request #885 from amosavian/master
2 parents fca0a34 + 73bfce2 commit 0cbb322

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Foundation/NSFileManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ open class FileManager : NSObject {
305305
let grd = getgrgid(s.st_gid)
306306
if grd != nil && grd!.pointee.gr_name != nil {
307307
let name = String(cString: grd!.pointee.gr_name)
308-
result[.groupOwnerAccountID] = name
308+
result[.groupOwnerAccountName] = name
309309
}
310310

311311
var type : FileAttributeType

TestFoundation/TestNSFileManager.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,23 @@ class TestNSFileManager : XCTestCase {
151151
let fileOwnerAccountID = attrs[.ownerAccountID] as? NSNumber
152152
XCTAssertNotNil(fileOwnerAccountID)
153153

154+
let fileGroupOwnerAccountID = attrs[.groupOwnerAccountID] as? NSNumber
155+
XCTAssertNotNil(fileGroupOwnerAccountID)
156+
157+
if let fileOwnerAccountName = attrs[.ownerAccountName] {
158+
XCTAssertNotNil(fileOwnerAccountName as? String)
159+
if let fileOwnerAccountNameStr = fileOwnerAccountName as? String {
160+
XCTAssertFalse(fileOwnerAccountNameStr.isEmpty)
161+
}
162+
}
163+
164+
if let fileGroupOwnerAccountName = attrs[.groupOwnerAccountName] {
165+
XCTAssertNotNil(fileGroupOwnerAccountName as? String)
166+
if let fileGroupOwnerAccountNameStr = fileGroupOwnerAccountName as? String {
167+
XCTAssertFalse(fileGroupOwnerAccountNameStr.isEmpty)
168+
}
169+
}
170+
154171
} catch let err {
155172
XCTFail("\(err)")
156173
}

0 commit comments

Comments
 (0)