• 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: Cocoa Calling Carbon Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Calling Carbon Question


  • Subject: Re: Cocoa Calling Carbon Question
  • From: Brian Hill <email@hidden>
  • Date: Mon, 11 Jun 2001 10:28:22 -0500

On Monday, June 11, 2001, at 09:15 AM, Stiphane Sudre wrote:

On lundi, juin 11, 2001, at 07:18 AM, Karl Goiser wrote:

Hello,

I don't know if this is a dumb question or not, but I can't work it
out. Can anybody help?


Short version:
How do I create an FSSpec from an NSString containg a full path name
(like /Users/karl/file1)?

For this kind of problem, I would have a look at the MoreFiles utilities; IIRC, they have been carbonized.


Or, in a nutshell:

Use this to convert a path to a FSRef:
(from Files.h)

extern OSStatus
FSPathMakeRef(
const UInt8 * path,
FSRef * ref,
Boolean * isDirectory); /* can be NULL */

and then this to convert the FSRef to a FSSpec:
(also from Files.h)

extern OSErr
FSGetCatalogInfo(
const FSRef * ref,
FSCatalogInfoBitmap whichInfo,
FSCatalogInfo * catalogInfo, /* can be NULL */
HFSUniStr255 * outName, /* can be NULL */
FSSpec * fsSpec, /* can be NULL */
FSRef * parentRef); /* can be NULL */

I remember seeing a way to do this via an intermediate CFURL also (on the Omni macosx-dev list), but I've found the above way to be a bit easier (YMMV).

Brian

email@hidden http://personalpages.tds.net/~brian_hill
___________________________________________________________
"Why? I came into this game for adventure - go anywhere, travel
light, get in, get out, wherever there's trouble, a man alone.
Now they've got the whole country sectioned off and you can't
move without a form. I'm the last of a breed."
-- Archibald "Harry" Tuttle, Rogue HVAC Repairman
___________________________________________________________


  • Follow-Ups:
    • Re: Cocoa Calling Carbon Question
      • From: Tom Waters <email@hidden>
References: 
 >Re: Cocoa Calling Carbon Question (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Re: Cocoa Calling Carbon Question
  • Next by Date: Swapping NSBitmapImageRep bitmapData's
  • Previous by thread: Re: Cocoa Calling Carbon Question
  • Next by thread: Re: Cocoa Calling Carbon Question
  • Index(es):
    • Date
    • Thread