• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Grabing Disk Information
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grabing Disk Information


  • Subject: Re: Grabing Disk Information
  • From: Jay Vaughan <email@hidden>
  • Date: Thu, 29 Apr 2004 00:21:27 +0200

I was wondering the way to grab all the Hard Drives infos.


execvp("/bin/sh", "/bin/ls -C1 /dev/disk* | /usr/bin/xargs -L 1 /usr/sbin/diskutil info");

oops, sorry, forgot this was a cocoa list. never mind any of that malarkey...

i have no foggy clue, whatsoever, how to do disk arbitration like that in Cocoa, (i guess you're "not supposed to", at that level of things) but i would nevertheless like to point out that you've still got -all- the unix'ish stuff available to you, in OSX, to do file/disk operations. if you ever get stuck, but can get the details from the command line, then you've at least got trusty ol' execvp() and co' to help you move things along ... and i bet you a nickel you can wrap a shell-escape/pipe situation into some snarfy Cocoa string-class or two, to give you what you need to stay in Objektiv-Z land ...

somewhere around, apple even have one or two papers on 'how to exec stuff properly from a CocoaFrameworkOrOther...' i'm sure its worth a grep through /Developer/Docs ...

personally, i don't see whats wrong with that approach, but i know a lot of others would consider it passi to approach things from that angle ... and, maybe, a little dangerous, if you don't know what you're doing...

(hint: "diskutil list" would've worked just as well, heh heh, but I threw that pipe in just to prove a point ...)

--

;

Jay Vaughan
_______________________________________________
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.


  • Follow-Ups:
    • Re: Grabing Disk Information
      • From: Bob Ippolito <email@hidden>
References: 
 >Grabing Disk Information (From: "Matthew Jaffa" <email@hidden>)

  • Prev by Date: Re: Enable Objective-C exception handling. [-fobjc-exceptions] causes additional warnings on pointers?
  • Next by Date: Re: Grabing Disk Information
  • Previous by thread: Re: Grabing Disk Information
  • Next by thread: Re: Grabing Disk Information
  • Index(es):
    • Date
    • Thread