Re: check if a file path is useable
Re: check if a file path is useable
- Subject: Re: check if a file path is useable
- From: Uli Kusterer <email@hidden>
- Date: Tue, 4 Sep 2007 11:00:06 +0200
On 03.09.2007, at 19:56, Mitchell Livingston wrote:
Yes, I have been looking at this, but I don't see a way to check if
I can simply create a file at a path without actually creating it.
Creating a file to check if it's doable seems like a bit too much
overhead and a bit messy. I don't see a way to use
isWritableFileAtPath: and the others without the file already
existing.
Considering you will be creating the file afterwards and this is a
multi-tasking OS, it's the only safe way to do this check, though.
Between your calls to isWritableFileAtPath: on the parent folder and
the time you actually create your file, aqnother app may be swapped
in by the schedules and may change these permissions, or someone who
has mounted the destination volume over the network may have changed
permissions.
So, isFileWritableAtPath: is mainly useful if you want to avoid the
user selecting a completely unsuitable place, i.e. you can use it to
restrict the UI, or better to show a warning to the user when they
try to select a certain destination folder. But the actual error
handling has to be when you create the file.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden