If you want to do it fast, without shell output parsing, and in a way
that will work on 10.4 *and* 10.5, use the Directory Services C API.
The downside is that it's more complex than many of the Cocoa APIs
you're likely used to.

Docs:

<http://developer.apple.com/documentation/Networking/Conceptual/Open_Directory/Introduction/chapter_1_section_1.html


<http://developer.apple.com/documentation/Networking/Reference/Open_Directory_Ref/Reference/reference.html


Lots of source to learn from (the dscl sources are a good place to
look for examples):

http://www.opensource.apple.com/darwinsource/Current/DSTools-112/


Thanks Michael and Phil
That seems to be the way to go. Looks like its not going to be as easy as I thought.
The source should make an interesting read.

On 31 Aug, 2008, at 10:43, Jaime Magiera wrote:


On Aug 31, 2008, at 4:57 AM, Kieren Eaton wrote:

Hi,

I am trying to find a way to access the netinfo DB from cocoa.
Specifically the sharing (AFP, SMB, etc).
Pointers or ideas are much appreciated.


Hello,

Quick question: Are you using Leopard or Tiger machines? On Tiger,
you can run the commands "niultil" or "nicl" to query the NetInfo
database from your application. Note that in Leopard, Netinfo has
been completely deprecated in favor of a local LDAP database. So, if
you are using Leopard, run the command "dscl" from your application.
In either case, you'll have to parse the command results in your app.

On Tiger, the path you want to query is...

/config/SharePoints/

On Leopard, the path you want to query is...

/Local/Default/SharePoints

hope that helps,

Jaime Magiera


Thanks Jaime. Currently I am Targeting 10.4 (my old G4 450Mhz wont run Leopard :(

but I will also be writing a separate App for Leopard once I have all the base data extraction understood.
So it looks like the Directory Services API is the way to go.

Kieren

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to