Re: [Solved] Re: Checking to see if a server volume is already mounted?
Re: [Solved] Re: Checking to see if a server volume is already mounted?
- Subject: Re: [Solved] Re: Checking to see if a server volume is already mounted?
- From: Adhamh Findlay <email@hidden>
- Date: Tue, 30 Oct 2007 22:52:18 -0500
Excellent point! This could should fix that problem:
// check to see if the iDisk is already mounted.
NSString *mountediDisk = nil;
struct statfs *buf;
int i, count;
const char *idiskName = [[NSString stringWithFormat: @"http://
idisk.mac.com/%@/", [dictionary valueForKey: @"username"]] UTF8String];
count = getmntinfo(&buf, 0);
for(i=0; i < count; i++) {
if(strcmp(buf[i].f_mntfromname, idiskName) == 0)
mountediDisk = [NSString stringWithUTF8String: buf[i].f_mntonname];
}
Instead of comparing f_mnttoname this compares f_mntfromname. This
should be a much more robust implementation.
Thanks for catching that!
Adhamh
On Oct 30, 2007, at 9:49 PM, John Stiles wrote:
Be careful. Mountpoints in /Volumes are not guaranteed to have the
same name as what you see in the Finder. For instance, rename your
hard drive to "Adhamh" and then mount your iDisk and see what its
mountpoint name is. (I'd guess Adhamh-1, but there's no guarantee
of that either.)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden