Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: check if a file path is useable



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >check if a file path is useable (From: Mitchell Livingston <email@hidden>)
 >Re: check if a file path is useable (From: Shawn Erickson <email@hidden>)
 >Re: check if a file path is useable (From: Mitchell Livingston <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.