Re: Cocoa and resource forks
Re: Cocoa and resource forks
- Subject: Re: Cocoa and resource forks
- From: Greg Robbins <email@hidden>
- Date: Sun, 13 Jun 2004 12:43:26 -0700
At 8:45 PM +0200 6/13/04, Tito Ciuro wrote:
>
If I embed this function call in my Cocoa code, is it a safe way to determine whether a file has a resource fork?
CountTypes assumes you've opened the resource file already. Try something like this instead:
BOOL HasResourceFork(NSString *path)
{
Boolean isDir;
FSRef ref;
OSStatus err = FSPathMakeRef([path fileSystemRepresentation], &ref, &isDir);
if (err == noErr)
{
FSCatalogInfo catInfo;
err = FSGetCatalogInfo(&ref, kFSCatInfoRsrcSizes, &catInfo, NULL, NULL, NULL);
if (err == noErr)
{
return (catInfo.rsrcLogicalSize > 0);
}
}
return NO;
}
Greg Robbins
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.