开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜