View Full Version : Get universal name of /Volumes
Jun 24, 2009, 08:14 AM
I am searching an API that will provide me the Universal name of /Volume mounted network path.
Ex: if i have a network path like smb://10.112.41.26/Bkup then i will get the path in MAC programming like this /Volumes/Bkup. Buit i want the actual path of /Volumes/Bkup that is //10.112.41.26/Bkup.
Any help would be appriciated.
Jun 24, 2009, 08:21 AM
smb certainly isn't universal. Are you saying that you want the samba path to a volume?
Jun 24, 2009, 09:12 AM
Thanks for the reply.
I couldn't understand the samba path.
I want the actual Network path of /Volume/Bkup as i mentioned in my post.
Mean i want to detect that the actual path is connected or not if Network path has been unmounted.
Jun 24, 2009, 07:48 PM
You could try looping through the mounted volumes via getmntinfo() and then use FSCopyURLForVolume() to get the URL for the volume. I've done this before to determine whether a volume is an iDisk, or ftp, etc., so it should work for you.
Jun 25, 2009, 03:46 AM
Thanks for the helpfull suggestion i got the solution and the code is below-
void getVolumeNameForPath(char* path)
err = FSPathMakeRef((UInt8 *) path, &ref, NULL);
assert(err == noErr);
err = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catInfo,
NULL, NULL, NULL);
err = FSCopyURLForVolume(catInfo.volume, &url);
str = CFURLGetString(url);
str will give full Netwirk path name includeing smb.