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



Unfortunately, it seems that you're confusing bundles and packages (though the documentation is a bit unclear at times).

A bundle is a folder formatted for the NSBundle/CFBundle APIs.

A package is a folder that appears in the Finder as a single document.

They are orthogonal concepts, and a folder may be either, both, or neither.

If you are looking to check for bundle-ness, try to create a CFBundle with it and check the error.

However, since you were trying to test the "bundle bit" (which actually was used in OS 9 for packages), you should use LSCopyItemInfoForRef (or ...URL) and look for the kLSItemInfoIsPackage bit in the LSItemInfoRecord's flags field.

Avi

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

 _______________________________________________
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.