Re: FSRefMakePath: error -35
Re: FSRefMakePath: error -35
- Subject: Re: FSRefMakePath: error -35
- From: Rosyna <email@hidden>
- Date: Sat, 22 Oct 2005 22:29:31 -0700
It isn't the worst code in the world at all. In fact, other than the
changes I mentioned, it is very similar to the way I did it (not sure
where I did it at).
Except I malloc the values instead of putting them on the stack and
do folders *after* all the files are done in a folder. This is to
prevent a HUGE amount of memory use while iterating. So I free the
malloced stuff before I go into the folders.
FSCatalogInfo* catalogInfoArray = (FSCatalogInfo
*)malloc(sizeof(FSCatalogInfo) * maxNumber);
FSRef* resultRefs=(FSRef *)malloc(sizeof(FSRef) * maxNumber);
// check for NULL on both of these even though in the current
implementation on OS X, these may never return null even if there is
no memory left for your process.
// get info about the file.
// if the file is a folder, add it to an array.
free( (void *) catalogInfoArray );
free( (void *) resultRefs );
err=FSCloseIterator(iterator); // if this ever fails you have serious issues.
// now iterate through each folder.
Ack, at 10/23/05, Lawrence Sanbourne said:
Thank you for the tips. This was obviously terrible code; I'm regret
copying it. If anyone has already written code that does this
efficiently, it would be wonderful if I could use it.
In the meantime, I will implement all of your suggestions. I've
responded to some of them within. Thank you for being so detailed.
It's very kind.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden