On 19/03/2010, at 8:59 PM, Nikhil Khandelwal wrote:
Hi,
Is there any way to lock a file in cocoa? I want to lock a file on
desktop programmatically so that I can't move that file to trash
until I unlock the file.
Thanks,
Nikhil
Hi Nikhil,
here's how I do it:
NSFileManager *fm = [NSFileManager defaultManager];
NSDictionary *attribs = [NSDictionary dictionaryWithObject:[NSNumber
numberWithBool:YES] forKey:NSFileImmutable];
[fm changeFileAttributes:attribs atPath:path];
Have a look at the NSFileManager Class Reference in the documentation.
Ron
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com