FSSpec from NSSavePanel
FSSpec from NSSavePanel
- Subject: FSSpec from NSSavePanel
- From: Harold Cooper <email@hidden>
- Date: Wed, 10 Jul 2002 14:38:45 -0600 (MDT)
Hi all. I've just wasted at least 2 hours trying to get an FSSpec (for
Quicktime - god forbid they update to FSRefs, or even NSURLs!)
Anyway, the furthest I've gotten (thanks to this list's archives) is the
following code:
+ (BOOL)makeFSSpec:(FSSpec *)spec withPath:(NSString *)path
{
FSRef ref;
OSStatus err =
FSPathMakeRef([path fileSystemRepresentation],&ref,NULL);
if(err==noErr)
err =
FSGetCatalogInfo(&ref,kFSCatInfoNone,NULL,NULL,spec,NULL);
return(err==noErr);
}
and then, elsewhere:
FSSpec file;
NSSavePanel savePanel = [[NSSavePanel savePanel] retain];
if([savePanel runModal] == NSFileHandlingPanelOKButton &&
[MyView makeFSSpec:&file withPath:[savePanel filename]])
...
[savePanel release];
the NSString that gets passed to makeFSSpecWithPath() is something like
@"/Users/cooperh/Desktop/test.png" (as verified by debugging
makeFSSpecWithPath()) so the problem isn't in the NSSavePanel. By further
debugging, I know that the error is in FSPathMakeRef() which is returning
-43, a file not found / incomplete path error.
so, if anyone knows if it's at all possible to make this FSSpec, I'd be so
very happy; Quicktime and Cocoa shouldn't be irreconcilably at odds!
thanks,
Harold Cooper
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.