osx - Converting a vRef and dirID (from a FSSpec) to a CFURL/NSURL -


I am in the process of moving one application of my company to a 64-bit environment, and thus I do not have access

There are some data structures in our file format that saved a vRefNum and dirID in the file from the old FSSpc format ... In the first we were able to use the carbon routine, from FSSPC to FSRF Going and finally for CFL, but FSSPC r Outines are available at 64 bit in all, and even dislike FSRF 10.9.

Internally we are using CFURL / NSURL but would still like to support conversion to these old file formats, is there any way, non-excluded (or at least 64-bit compatible ) Can I get a CFR and can be found between vRefNum and dirID using routines?

Many more thanks.

This is not supported by Apple, but you can use the volfs file system to do this See the following documents from Apple:

This is a function that creates CFRRF with volume ID and directory ID:

Pre> create sefruurf URLFromVolumeID and directory id (dev_t) VolumeID, SInt32 directoryID) {CFStringRef thePath = CFStringCreateWithFormat (KCFLocater Ifolt, NULL, CFSTR ( "/. Volume /% d /% d"), volumeID, (int) directoryID); CFURLRef theURL = CfLCreativeFileSystemPath (KCFLoocorte, Default, The Path, KCFRRPSISXPathStyle, Incorrect); CFRelease (thePath); Return URL; }

To use Wolfsms, you will need to change your volume reference number to a volume ID. One way to do this is:

  dev_t ConvertVolumeRum Nmato VolumeID (FSWolmRfNewfell) {FSRFed Route; OSErr Error = FSGetVolumeInfo (refNum, 0, NULL, kFSVolInfoNone, NULL, NULL, & Root); If (error! = NoErr) 0; UInt8 path [500]; Ossetatus status = FSRIFMA path (and root, path, 500); If (status! = NoErr) 0; Structure State Volstatus; Int err = stat ((const char *) path, & amp; Vostats;); If (error! = 0) 0 returned; Return volStats.st_dev; }  

According to the linked documentation, the app should never do this, and it may stop working in any future version of OS X. But you asked ...

In addition, the volume reference number is not guaranteed when a volume is unmounted and then remounted, so if you are writing them on disk, you There is another problem.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -