How do I get the server hostname from a mounted directory with cocoa/obj-c?

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-04-05T18:34:11Z Indexed on 2010/04/05 18:53 UTC
Read the original article Hit count: 288

Filed under:
|
|
|
|

Currently when I open a file with my program I can select files on a server by clicking on the server name in the sidebar in an NSOpenPanel and then selecting the file. No problem, this works fine for using the file as long as the shared directory is mounted. I get a path like "/Volumes/SHARENAME/filename.bla".

My question is how do I get the server hostname of the computer it came from. For instance, if I clicked on the device with name SERVERNAME under "Shared" in the NSOpenPanel how do I get SERVERNAME from "/Volumes/SHARENAME/filename.bla".

I have looked at quite a bit of documentation and have been unable to find a solution for this problem.

Any help toward this will be greatly appreciated. Thank you.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about hostname