Determining read-only status of a file/folder (isWritableFileAtPath)?
Determining read-only status of a file/folder (isWritableFileAtPath)?
- Subject: Determining read-only status of a file/folder (isWritableFileAtPath)?
- From: Keith Blount <email@hidden>
- Date: Sat, 27 Oct 2007 04:48:49 -0700 (PDT)
Hi,
My app uses a project-based format - really just a folder full of files but with an extension so that it looks like a regular file. As such, when a project is opened, the main project file is opened by the app (kind of like the .xcodeproj file in Xcode) and other files inside the package are opened as needed. Because of this, and because my app has an auto-save feature, my app doesn't support the opening of read-only projects, or of projects that are stored in non-writable locations.
Thus, if the user tries to open a project from a non-writable location, my program just spews a message saying that it doesn't support read-only files and gives the user a hint about what to do.
I'm using NSFileManager's -isWritableFileAtPath: to check this. I check the package folder itself, and also the main project file inside. If the file manager returns one or both as not being writable, the user gets the message.
For the most part, this works fine. However, occasionally I get users reporting to me that they have received this message when they shouldn't - often, for instance, when the project is stored on an external drive (which is nonetheless writable) or when they are accessing it over a network.
The docs don't really explain the exact circumstances in which -isWritableFileAtPath: returns NO. So, my question is, is NSFileManager the best way of doing this, or is there a better way? (Please don't tell me off for not supporting read-only projects. :) I hope to do so in a future version...)
All the best,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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