Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

imranpundeer

macrumors newbie
Original poster
Jan 10, 2009
25
0
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
 

imranpundeer

macrumors newbie
Original poster
Jan 10, 2009
25
0
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

Moderator emeritus
Jun 15, 2000
7,958
7
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

macrumors newbie
Original poster
Jan 10, 2009
25
0
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 :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.