AP.
AP.

Reputation: 5323

Get and set owner, group and permissions in Cocoa

I am looking how to get (and set) owner, group and permissions in Cocoa for a given file.

What is the best way to do this? (and how to check if the current user is granted enough to change these permissions)

Thanks for your help,

Regards,

Upvotes: 3

Views: 2027

Answers (1)

JeremyP
JeremyP

Reputation: 86651

NSFileManager has a method -setAttributes:OfItemAtPath:error: which will do the trick. Check out particularly the NSFilePosixPermissions key. If the method fails, it returns false and the details of the error are placed in the NSError** you give it.

Upvotes: 4

Related Questions