• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: FSSpec from NSSavePanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Drag and drop custom classes
  • Next by Date: Memory leak in printf?
  • Previous by thread: FSSpec from NSSavePanel
  • Next by thread: Determining Local Time Formats
  • Index(es):
    • Date
    • Thread