• 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
Problems converting NSString path to FSSpec
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems converting NSString path to FSSpec


  • Subject: Problems converting NSString path to FSSpec
  • From: "Josh Ferguson" <email@hidden>
  • Date: Thu, 28 Feb 2002 14:59:44 -0600
  • Thread-topic: Problems converting NSString path to FSSpec

I've been trying to figure out this problem I've been having with the FSGetCatalogInfo function when trying to convert a NSString path to a FSSpec (through a CFURLRef, and an FSRef). The function I'm using is shown below:

OSErr FilePathToFSSpec( NSString* asFilePath, FSSpec* apSpec )
{
CFURLRef cfUrl = CFURLCreateWithFileSystemPath( kCFAllocatorDefault,
(CFStringRef) asFilePath, kCFURLPOSIXPathStyle, false );
FSRef fileRef;
OSErr err = noErr;

if ( CFURLGetFSRef( cfUrl, &fileRef ) ) {
err = FSGetCatalogInfo( &fileRef, kFSCatInfoNone, NULL,
NULL, apSpec, NULL );
if ( err ) return( err );
}

CFRelease( cfUrl );
return( err );
}

Every time it reaches the call to FSGetCatalogInfo, I get an EXC_BAD_ACCESS. I'm relatively confident that all functions before that are working correctly; CFURLGetFSRef will only succeed if I pass a valid path. I'm guessing it's something stupid that I'm doing, but I can't think of what it would it could be! Any ideas? Is there an easier way to do this?

Thanks!

Josh Ferguson
_______________________________________________
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: determining binary files from text
  • Next by Date: Re: determining binary files from text
  • Previous by thread: Re: determining binary files from text
  • Next by thread: Re: Problems converting NSString path to FSSpec
  • Index(es):
    • Date
    • Thread