Hi, thanks to all of you. After some days trynign and thinking, I have used lstat to check the filePermissions because I need to check thousands files per session. However I realized that Permissions and isReadableFile or isWritableFile or isDeletableFile are two different things, so please may you tell me whether my methods here below are right or wrong? Short version:
IsReadableFile:filePath cPath = [mManager fileSystemRepresentationWithPath:filePath]; lstat(cPath, &sb); return ((sb.st_mode & S_IRUSR) != 0); IsWritableFile:filePath //I check here the ParentFolder of the filePath parentFolder = [filePath stringByDeletingLastPathComponent]; cPath = [mManager fileSystemRepresentationWithPath:parentFolder]; lstat(cPath, &sb); return ((sb.st_mode & (S_IWUSR | S_IXUSR)) != 0); IsDeletableFile:filePath the same as IsWritableFile:filePath above Will these methods work on any volume mounted on my desktop? (e.g. Local volume, remote volume, disk image volume, on webdav, smb, ftp, afp, hfs, on remote win disk...) Thanks Leo > Da: Kevin Perry <kpe...@apple.com> > Data: Mon, 1 Mar 2010 11:37:06 -0800 > A: "gMail.com" <mac.iphone....@gmail.com> > Cc: <cocoa-dev@lists.apple.com> > Oggetto: Re: IsReadableFileAtPath > > > -Kevin > > On Mar 1, 2010, at 11:20 AM, gMail.com wrote: > >> Hi, >> I need to check whether a file or a symlink could be really copied. >> I have just seen that the Cocoa API isReadableFileAtPath traverses the >> symlink, so, in case the target file is not readable, my app doesn't copy >> the symlink, while the Finder can properly do. So my app does wrong. >> >> The question is: >> How can I understand whether a file or symlink can really be copied? >> I have seen that isReadableFileAtPath uses the C command "access" which >> indeed traverses the symlink. So I cannot use it. So, any idea? >> And I wouldn't use the Carbon APIs because I need to compile for 64 bit. >> Thank you. >> >> Leonardo >> >> >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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/kperry%40apple.com >> >> This email sent to kpe...@apple.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com