Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Foundation/NSFileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ open class FileManager : NSObject {
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
Expand Down
17 changes: 17 additions & 0 deletions TestFoundation/TestNSFileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ class TestNSFileManager : XCTestCase {
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)")
}
Expand Down