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: isBundle trace-out problem



Your test will only check the bundle bit on a file or folder, which is not a
requirement on Mac OS X 10.0 or later for bundles; it was a requirement for
packages (i.e., bundles) on Mac OS 9, and that was how the Finder used to know
when there were icons and types associated with an application in the old days
(plists are the Mac OS X equivalent). Some development tools will set this
bit, but they don't have to.


I think you can rely on trying CFBundleCreate and see if you get NULL back or
not to determine if the object is a bundle, but I thought there was a more
explicit call, but I can't think of it right now.


Quoting Apparao <email@hidden>:

Hi List,
 Following method returns false, if i pass correct absolute bundle
path. Is there is anything wrong in this method:

- (BOOL) isBundle:(NSString *)inPath {
FSCatalogInfo info; FSRef fileRef; OSErr err = noErr; Boolean isDirectory;


 const char *path = [inPath cString]; err = FSPathMakeRef ((UInt8 *)
path, &fileRef, &isDirectory);    if( err != noErr)  return NO;
 err = FSGetCatalogInfo( &fileRef, kFSCatInfoFinderInfo, &info,
NULL,NULL, NULL );    if( err != noErr )        return NO;

  FileInfo*    fInfo = (FileInfo*) info.finderInfo;

  BOOL result =  fInfo->finderFlags & kHasBundle;

      NSLog(@"fInfo->finderFlags %x", fInfo->finderFlags);
NSLog(@"kHasBundle %x", kHasBundle);

     NSLog(@"Path: %@ \n result %d", inPath, result); return result;
}
Thanks,- Apparao


_______________________________________________
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: 
 >isBundle trace-out problem (From: Apparao <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.