Creating local path from path with ':' seperators

Creating local path from path with ':' seperators

Post by Harpstei » Sat, 23 Aug 2003 01:11:53


heya,

I've got a path like "Mac HD:Users:harpstein:"

and I want to convert it to the real path of "/Users/harpstein"


I've found the FileManager routine FSRefMakePath, but can't figure out how
to create the FSRef from the path I have.

Any examples would be greatly appreciated.


Thanks,

harpstein
 
 
 

Creating local path from path with ':' seperators

Post by Mark Da » Sat, 23 Aug 2003 05:05:30

In article < XXXX@XXXXX.COM >, Harpstein



// the following is untested, and may have syntax errors

OSErr err;
FSRef ref;
FSRefParam pb;

pb.ioVRefNum = 0;
pb.ioDirID = 0;
// Note the "\p" in the string below. ioNamePtr must point to a
// Pascal style string -- one with a leading length byte.
pb.ioNamePtr = "\pMac HD:Users:harpstein:";
pb.newRef = &ref;
err = PBMakeFSRefSync(&pb);

// Or, if you had the original path in the form of an FSSpec:

FSSpec spec;
FSRef ref;

// Fill in "spec", or get it returned via another call...
err = FSpMakeFSRef(&spec, &ref);

-Mark