Re: Getting Name of root Volume
Re: Getting Name of root Volume
- Subject: Re: Getting Name of root Volume
- From: Brian Hill <email@hidden>
- Date: Fri, 1 Jun 2001 17:02:13 -0500
On Friday, June 1, 2001, at 01:37 PM, Eric Peyton wrote:
FSPathMakeRef("/", &fsRef, NULL); to get an fsRef to "/"
FSGetCatalogInfo(&fsRef, kFSCatInfoVolume, &info, NULL, NULL, NULL);
obviously - this code doesn't get you everything you need
you will probably need to use something like
extern void
PBGetVolumeInfoAsync(FSVolumeInfoParam * paramBlock);
And pass in the FSVolumeRefNum you get out of the FSCatalogInfo up
above.
Actually, if you can make the assumption that the root volume is the
first one mounted, then it's possible to just use a call to
PBHGetVInfoSync.
I just tried this code, and it worked for me. Again, it depends on the
assumption that the root volume will be the one with the volumeIndex of
1.
<CODE>
HParamBlockRec vpb;
Str31 name;
OSErr err;
id str = nil;
name[0]=0;
vpb.volumeParam.ioNamePtr = name;
err = noErr;
vpb.volumeParam.ioVolIndex = 1;
err = PBHGetVInfoSync(&vpb);
if (err == noErr)
{
str = [NSString stringWithCString:&name[1] length:name[0]];
NSLog(@"Root Volume Name: %@",str);
} else {
NSLog(@"Error %d",err);
}
</CODE>
YMMV. I'm not really sure if the assumption is correct, but it returned
the name of my root volume and I have 3 of them mounted.
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