On 2009-12-18, at 1:11 PM, Sandro Noël wrote:

> On 2009-12-18, at 12:25 PM, Jens Alfke wrote:
> 
>> 
>> On Dec 18, 2009, at 6:12 AM, Sandro Noël wrote:
>> 
>>> there are some system protected folders that will not allow themselves to 
>>> be renamed.
>>> I would like to disable the possibility of even starting to edit there 
>>> names in my interface.
>>> I would need a function that can tell me if the folder I'm trying to rename 
>>> is actually a system protected folder.
>> 
>> Use NSFileManager to check whether you have write access to the directory 
>> and its parent directory.
>> 
>> —Jens
> 

it does not work, even if i select the root folder of my hard drive i still get 
the permission to rename it.

BOOL valid = [[NSFileManager defaultManager] isWritableFileAtPath:[node.nodeURL 
path]];
BOOL validParent = [[NSFileManager defaultManager] 
isWritableFileAtPath:[[node.nodeURL URLByDeletingLastPathComponent]path]];
return (valid && validParent);

Any other ideas?_______________________________________________

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

Reply via email to