Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating FSRef from vrn, dirID, and name



On Mar 13, 2007, at 08:52:01, Steve Mills wrote:

I'm sure this has an obvious answer, but I'm having a senior moment or something. How can I create an FSRef for a folder given a volume ref num, parent directory ID, and folder name given as Unicode? I thought it was possible with PBMakeFSRefUnicodeSync, but it looks like it only takes the parent directory as an FSRef in the ref field, not as a pair of ioVRefNum and ioDirID.

I found one way to do this, but it requires 2 steps:

OSErr MakeFSRef(const FSVolumeRefNum vrn, const UInt32 dirID, const ustring& name, FSRef* const fsr)
{
FSRefParam parm;
Str255 s;
OSErr err;
FSRef parent;

parm.ioCompletion = nil;
parm.ioNamePtr = s;
*s = 0;
parm.ioVRefNum = vrn;
parm.ioDirID = dirID;
parm.newRef = &parent;
PBMakeFSRefSync(&parm);

if((err = parm.ioResult) == noErr)
err = FSMakeFSRefUnicode(&parent, name.size(), name.data(), kTextEncodingUnknown, fsr);

return err;
}


Is this the best method for doing this? Seems like there should be a 1-step api.

_________________________________________________________
Steve Mills                              Me: 952-401-6255
Senior Software Architect                         MultiAd
email@hidden                       www.multi-ad.com


_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Creating FSRef from vrn, dirID, and name (From: "Steve Mills" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.