Re: Error with malloc and NSFileWrapper
Re: Error with malloc and NSFileWrapper
- Subject: Re: Error with malloc and NSFileWrapper
- From: Ken Thomases <email@hidden>
- Date: Fri, 19 Dec 2008 03:12:15 -0600
On Dec 17, 2008, at 7:22 PM, Guillaume Campagna wrote:
I'm using a NSDirectoryEnumerator to add all the content of a folder
to some array... I'm filtering these files (I don't want certains
types of files). One of these file types is symbolic link (alias).
So I'm using NSFileWrapper to check that with -(BOOL) isRegularFile.
Don't do that. That's not what NSFileWrapper is for. Note especially
that NSFileWrapper is going to enumerate all the files for any
directory you specify for the path, meaning you'll enumerate every
directory multiple times, once for each parent it has.
Use this:
if ([[[e fileAttributes] fileType] isEqualToString:NSFileTypeRegular])
// ...
where 'e' is the directory enumerator you're using. In other words,
the enumerator already provides a convenient way to obtain the file
attributes you're looking for.
Cheers,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden