tags:

views:

130

answers:

1

Is there any way of retrieving an absolute URL for a file on a mounted volume in Cocoa? For example, say afp://server/Documents is mounted at /Volumes/Documents. How can I get full URL to a file on the mounted volume in the form of afp://server/Documents/path/to/file?

I've tried using statfs but the value of f_mntfromname doesn't contain a url, it contains the same value that is given by the mount command.

A: 

Did you try this?

http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSURL_Class/Reference/Reference.html#//apple_ref/doc/uid/20000301-BAJHIJAH

Azeem.Butt
[[NSURL fileURLWithPath: @"..."] absoluteString] returns URLs using the file:// protocol; It doesn't understand mount points. It works well if you're doing something ephemeral, but if you need a persistent, stable URL it doesn't work; since the volume could be mounted somewhere else, or not mounted at all, the next time you try to use it.
Bryan Kyle
If that doesn't do it then Cocoa's probably several levels too high. Try this http://stackoverflow.com/questions/2243531/determine-afp-share-from-a-file-url
Azeem.Butt