If you're using 10.5 you can try the method:

-(NSDictionary *)attributesOfItemAtPath:(NSString *)path error: (NSError **)error

This way you will get a description of what is failing from the NSError object. You can use it like this:

NSError *theError;
NSDictionary *fileAttributes = [manager attributesOfItemAtPath:fullPath error:&theError];

if( fileAttributes != nil ) {
        // do your things
} else {
NSLog(@"Error retrieving file attributes for %@: %@", fullPath, [theError localizedDescription]);
}

That should help you track down what might be going wrong at least....

On Aug 18, 2008, at 15:24 , Nicolas Goles wrote:

Hi guys, I am trying to get fileAttributesAtPath using this code: (files
contains the path to the directory that was enumerated )

       while(object = [dirEnumerator nextObject])
       {

           //First We craft the whole path for a single object

NSString *fullPath = [files stringByAppendingString:object];

NSLog(@"%@",fullPath); //Log the full path just to be sure it's
correct

           if(!fullPath)
           {
               NSLog(@"Error when appending strings");
           }

           //Try to obtain fileAttributes
           NSDictionary *fileAttributes = [manager
fileAttributesAtPath:fullPath traverseLink:NO];

           if( fileAttributes != nil)
           {

               NSString *filetype = [fileAttributes
objectForKey:NSFileType];
               NSLog(@"%@",filetype);
           }

           if(!fileAttributes)
           {
               NSLog(@"it's nill");
           }
    }

The thing is that my fileAttributes it's always = nil so I always get "it's
nill"  on the console.

Could anyone point me at what I'm doing wrong ???

Thanks!! :)

--
-Nicolas Goles
_______________________________________________

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/jason.coco %40gmail.com

This email sent to [EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to