Re: FSRefMakePath: error -35
Re: FSRefMakePath: error -35
- Subject: Re: FSRefMakePath: error -35
- From: Rosyna <email@hidden>
- Date: Sat, 22 Oct 2005 22:33:26 -0700
That code is fine. It's this code that is wrong:
unsigned long long LSDirectorySizeAtPath(NSString *inPath)
{
unsigned long long totalSize = 0;
FSIterator thisDirEnum;
FSRef *theFileRef;
OSStatus makePathErr = FSRefMakePath(theFileRef, (UInt8 *)[inPath
UTF8String], [inPath length]);
if (makePathErr != noErr) {
NSLog(@"LSDirectorySizeAtPath: Unable to make path %@
into an FSRef:
error %d", inPath, makePathErr);
return totalSize;
}
The FSRef there isn't valid it should be:
FSRef theFileRef;
OSStatus makePathErr = FSRefMakePath((UInt8 *)[inPath
fileSystemRepresentation], &theFileRef, NULL);
Ack, at 10/23/05, Lawrence Sanbourne said:
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.
Wait, though. I'm trying to call my function recursively, but it takes
an NSString * as an argument. fetched->fFSRefs[thisIndex] is not an
unitialized pointer because it was set by FSGetCatalogInfoBulk. So
don't I need FSRefMakePath ("Converts an FSRef into a path," according
to the documentation)?
Code:
UInt8 utf8Path[PATH_MAX*6];
OSStatus makePathErr = FSRefMakePath(&fetched->fFSRefs[thisIndex],
utf8Path, PATH_MAX*6);
if (makePathErr == noErr)
totalSize += LSDirectorySizeAtPath([NSString
stringWithUTF8String:(char *)utf8Path]);
else
NSLog(@"LSDirectorySizeAtPath: Error making FSRef
into path: error
%d", makePathErr);
--
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