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: How to get the Read only status of files



Yes.  You are right.
 
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.
 
Thanks for the help.
 

 
On 11/2/07, Mark Wagner <email@hidden> wrote:
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

References: 
 >How to get the Read only status of files (From: "Tolu Fapohunda" <email@hidden>)
 >Re: How to get the Read only status of files (From: "Mark Wagner" <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.