Luke;

I've adapted the code to accomodate your's and Chris' answer to question 2.

Here's the entire method, which now shows not static analyzer issues but I still would like to understand why not.

+ (NSDictionary *)metadataForFilePath:(NSString *)thisPath {
        NSDictionary *md = [NSDictionary dictionary];
        if (![[NSFileManager defaultManager] fileExistsAtPath:thisPath]) {
                NSLog(@"file does not existl");
        } else {
                MDItemRef mdi = MDItemCreate( nil, (CFStringRef)thisPath );
                if  ( mdi != nil )  {
                        CFArrayRef arrayRef = MDItemCopyAttributeNames(mdi);
                        CFDictionaryRef dictRef = MDItemCopyAttributes( mdi, 
arrayRef);
                        md = [NSDictionary 
dictionaryWithDictionary:(NSDictionary *)dictRef];
                        CFRelease(dictRef);
                        CFRelease(arrayRef);
                } else {
                        NSLog(@"mdi is nil");
                }
        }
        return md;
}

Is this the 'best' this can be?
Thanks for helping me learn,
Steve

On Sep 18, 2009, at 6:44 PM, Luke the Hiesterman wrote:

There's not enough code here to give a good answer to question 1.

_______________________________________________

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

Reply via email to