Re: FSRefMakePath: error -35
Re: FSRefMakePath: error -35
- Subject: Re: FSRefMakePath: error -35
- From: Rosyna <email@hidden>
- Date: Sat, 22 Oct 2005 21:37:50 -0700
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.
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.
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.
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...
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.
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.
_______________________________________________
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