Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MayPeng

macrumors member
Original poster
Nov 21, 2010
53
0
When enumerating the disk using the same Application , it will appear the following disk on one mac mini 10.7.3:
+Macintosh HD
+home
+net
but it will not appear the home and net disks on another mac mini 10.7.3

How to delete the home and net disks?
THS!
 
What are you using to get the disk names? The home and net disks are placeholders for networked volumes, and can't be deleted.

Code of listing the drive is the following:

#Define MAX_LIST_DRIVE_NUM 50
DriveNameInfo driveList[MAX_LIST_DRIVE_NUM ];
memset(driveList, 0 , sizeof(driveList));

OSErr result = noErr;
int volumeIndex = 0;
FSVolumeRefNum refNum;
HFSUniStr255 volumeName;
UInt16 nameLen = 0;

for(volumeIndex = 1; result == noErr ; volumeIndex++)
{
result = FSGetVolumeInfo(kFSInvalidVolumeRefNum,
volumeIndex,
&refNum,
kFSVolInfoNone,
NULL,
&volumeName,
NULL);

if(result == noErr )
{
//get the drive's info
CFStringRef volumeNameRef = CFStringCreateWithCharactersNoCopy(
kCFAllocatorDefault,
volumeName.unicode,
volumeName.length,
kCFAllocatorDefault);

//get the drive's name
CFStringGetFileSystemRepresentation(volumeNameRef,
driveList[voluneIndex -1].name,
NAME_MAX);

//Save length of the drive's name
nameLen = volumeName.length < strlen(driveList[volumeIndex - 1].name) ? strlen(driveList[volumeIndex - 1].name) : volumeName.length;
driveList[volumeIndex - 1].nameLen = CFSwapInt16HostToLittle(nameLen);

//Fil in the attribute
driveList[volumeIndex - 1].attribute = CFSwapInt16HostToLittle('l');
}
}

How to control the code or other methods not to list the home and net drive?
 
Last edited:
Code:
    result = FSGetVolumeInfo(kFSInvalidVolumeRefNum, 
                                       volumeIndex, 
                                       &refNum,
                                       kFSVolInfoNone, 
                                       NULL, 
                                       &volumeName,
                                       NULL);
How to control the code or other methods not to list the home and net drive?

A first step would be to pass something other than kFSVolInfoNone and NULL.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.