Re: Find if mounted volume is Local or Network?
Re: Find if mounted volume is Local or Network?
- Subject: Re: Find if mounted volume is Local or Network?
- From: Jerry Krinock <email@hidden>
- Date: Fri, 6 Nov 2009 11:02:04 -0800
Thank you all. Indeed, statfs works.
Jerry
#import <sys/mount.h>
/*!
@brief Determines whether or not a the volume containing a
given path is mounted locally or via a network connection.
@details Uses statfs
@param isLocal_p Pointer which will, upon return, point
to a BOOL indicating YES if the volume is mounted locally,
NO if it is mounted via network connection. Must not be NULL.
@param error_p Pointer which will, upon return, if an error
occurred and said pointer is not NULL, point to an NSError
describing said error.
@result YES if the operation completed successfully,
otherwise NO.
*/
+ (BOOL)path:(NSString*)path
isLocal_p:(BOOL*)isLocal_p
error_p:(NSError**)error_p ;
+ (BOOL)path:(NSString*)path
isLocal_p:(BOOL*)isLocal_p
error_p:(NSError**)error_p {
BOOL ok = YES ;
struct statfs aStatfs ;
NSInteger statErr = statfs([path UTF8String], &aStatfs) ;
if (statErr != 0) {
ok = NO ;
if (error_p) {
*error_p = [NSError errorWithPosixErrorCode:errno] ;
}
}
*isLocal_p = (aStatfs.f_flags & MNT_LOCAL) > 0 ;
return ok ;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden