How to get hard drive name
How to get hard drive name
- Subject: How to get hard drive name
- From: Lorenzo <email@hidden>
- Date: Tue, 20 Jan 2004 21:21:35 +0100
Hi,
given a file "theFile"
NSString *theFile = @"/Volumes/MyDisk/MyFolder/MyFile";
NSString *diskName;
NSFileManager *manager = [NSFileManager defaultManager];
you can get the volume name this way:
// this will give you an array of path components you can use
// to display the path to the user in the MacOS 9 style.
pathDisplayArray = [manager componentsToDisplayForPath:theFile];
// the first item of the array contains the disk name @"MyDisk"
// so take it from the array with the index = 0;
if(pathDisplayArray && [pathDisplayArray count] > 0){
diskName = [pathDisplayArray objectAtIndex:0];
}
// if theFile is on your boot disk like this
theFile = @"/MyBootDisk/MyFolder/MyFile";
// you will get diskName = @"MyBootDisk";
Best Regards
--
Lorenzo
email: email@hidden
>
>
Message: 14
>
To: email@hidden
>
From: "Ian G. Gillespie" <email@hidden>
>
Subject: How to get hard drive name
>
Date: Tue, 20 Jan 2004 11:30:21 -0800
>
>
Greetings,
>
>
Does anyone know how I can get the name of a user's hard drive, or the
>
hard drive partition on which their user account resides?
>
>
~Ian
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.