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

newformac

macrumors regular
Original poster
May 24, 2011
107
0
how to i get how nay drive are connected with mac machine.

get this list with drive details like name,serial num or volume etc. and so on.

thank.

any help and suggestion on this will be appreciated.
 
how to i get how nay drive are connected with mac machine.

get this list with drive details like name,serial num or volume etc. and so on.

thank.

any help and suggestion on this will be appreciated.

"About this Mac", "More Info".
 
Look into DiskArbitration framework, which is a higher level wrapper for IOKit. Both are C-based APIs though, there is no native Objective-C one.
 
I don't know why some folks resist the notion that you can also programmatically simply use NSTask or NSPipe to call a helper function that will do the job for you...

B
 
I don't know why some folks resist the notion that you can also programmatically simply use NSTask or NSPipe to call a helper function that will do the job for you...

Because then you are dependent on the absolute formatting of the text output. The moment something changes (which it does on a regular basis), then you are screwed. This sort of thing is fine for scripts that you make for yourself, and can maintain yourself, but it is not fine for things that you share with others (free or not).

And there are solid APIs on MacOS X for this. When programming you should use them.
 
Because then you are dependent on the absolute formatting of the text output. The moment something changes (which it does on a regular basis), then you are screwed. This sort of thing is fine for scripts that you make for yourself, and can maintain yourself, but it is not fine for things that you share with others (free or not).

And there are solid APIs on MacOS X for this. When programming you should use them.


Not in this case. If you actually took the time to look at what was suggested you'd see this from the man page:

If -plist is specified, then a property list will be emitted instead of the normal user-readable output. If a device is specified, then instead of listing all families of whole disks and their partitions, only one such family is listed. In that case, specifying either the whole disk or any of its slices will work. The -plist and device arguments may not both be specified at the same time.

So the format is designed specifically for this sort of usage.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.