But my real intent is to find out if I have enough permissions to rename a file. And as Kevin said, "Write permission on a directory affects whether or not you can rename files, or add other files and subdirectories to the directory." In essence, I only needed to check the read-write permission of the folder.
I am currently using access which works fine. The only scary thing is the caveat of access that states "Access() is a potential security hold and should never be used. It seems that all I need to use is PBHGetDirAccessSync and just check the appropriate bits.
On 11/1/07, Tolu Fapohunda <email@hidden> wrote:
> Hello, > > I need to determine if a file is read only based on its attributes, the > attributes of each parent folder(s), and on it volume on which it resides. > For example, a file on a CD should always be read only. Is there an OS call
> to accomplish this? > > I am able to get the attributes of files and directories by themselves using > PBGetCatalogInfoSync and PBHGetDirAccessSync respectively. Currently, what > I do is check the file, check each parent directory of the file, and then
> finally check the volume in which the file resides. This is way too much > and it seems like I am missing something here.
You don't need to check the parent directories: a read-write file can
exist in a read-only directory. You only need to check the permissions (POSIX and ACL) of the file itself, and check to see if the file is on a read-only volume.
-- Mark Wagner
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden