Re: FSSpec from NSSavePanel
Re: FSSpec from NSSavePanel
- Subject: Re: FSSpec from NSSavePanel
- From: Nathan Day <email@hidden>
- Date: Thu, 11 Jul 2002 21:04:39 +0930
If you want to deal with NSURLs instead of NSStrings containing paths
you could use the core foundation method
CFURLGetFSRef( (CFURLRef)theURL, &aFsRef )
I use NSURLs most of the time, it seems to make it easier when trying to
take advantage of carbon.
On Thursday, July 11, 2002, at 06:08 AM, Harold Cooper wrote:
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!
_______________________________________________
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.