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,
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.
精彩评论