View Full Version : Get universal name of /Volumes
imranpundeer
Jun 24, 2009, 09:14 AM
Hi Friends,
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.
Regards,
Shadab
lee1210
Jun 24, 2009, 09:21 AM
smb certainly isn't universal. Are you saying that you want the samba path to a volume?
-Lee
imranpundeer
Jun 24, 2009, 10:12 AM
Hi Lee,
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.
Regards,
Imran.
kainjow
Jun 24, 2009, 08: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.
imranpundeer
Jun 25, 2009, 04:46 AM
Hi,
Thanks for the helpfull suggestion i got the solution and the code is below-
void getVolumeNameForPath(char* path)
{
int err=0;
CFStringRef str;
FSRef ref;
FSCatalogInfo catInfo;
CFURLRef url;
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.
Thanks :)
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.