Re: FSRefMakePath: error -35
Re: FSRefMakePath: error -35
- Subject: Re: FSRefMakePath: error -35
- From: Lawrence Sanbourne <email@hidden>
- Date: Sun, 23 Oct 2005 00:18:41 -0500
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.
On 10/22/05, Rosyna <email@hidden> wrote:
> Well, that's why it is failing. You're passing a random pointer to an
> FSRef. You want to use FSPathMakeRef instead of FSRefMakePath.
>
> Also, use -fileSystemRepresentation instead of -UTF8String on the
> path. In most cases they won't differ in what they return, but there
> are a bout 1 or 2 in which they will. So better to use the method
> specifically designed for this.
Great, glad to know of this method.
> Also, 256 per fetch is a bit too much. I suggest around 40 or use
> ((getpagesize() * 4) / sizeof(FSCatalogInfo)); to programmatically
> get the optimum size.
Cool.
> And if you pass PATH_MAX to:
>
> UInt8 utf8Path[PATH_MAX];
> OSStatus makePathErr =
> FSRefMakePath(&fetched->fFSRefs[thisIndex], utf8Path, PATH_MAX);
>
> It *will* fail on some people's computers. Try to use something much
> larger (if possible). I usually use PATH_MAX*6, although that still
> isn't the best way to do it. You can keep calling FSRefMakePath with
> a larger size until it doesn't return errFSNameTooLong. But you might
> want to stop at some high reasonable number like PATH_MAX*100 or
> something so it doesn't loop forever.
Hmm, this sounds ugly. I think for simplicity I'll use PATH_MAX*6.
> And
>
> while (fsErr == noErr || fsErr == errFSNoMoreItems) {
>
>
> Huh? It'll never evaluate the latter since you break if fsErr ==
> errFSNoMoreItems and if it were to evaluate, well...
Things like this make me embarrassed to have copied this code!
> And you are only counting the size for the data forks in a folder,
> you might want to add the resource fork size in as well.
I definitely do.
Thanks again for all your help!
Larry
> Ack, at 10/22/05, Lawrence Sanbourne said:
>
> > FSRef *theFileRef;
> > OSStatus makePathErr = FSRefMakePath(theFileRef, (UInt8 *)[inPath
> >UTF8String], [inPath length]);
>
> --
>
>
> 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.
>
--
Larry Sanbourne
email@hidden
_______________________________________________
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