detecting the USB drives
detecting the USB drives
- Subject: detecting the USB drives
- From: "Gurmit Teotia" <email@hidden>
- Date: Tue, 21 Nov 2006 18:10:15 +0530
Hi
I'm detecting the USB drives in my application using NSWorkspace
class. Sample code is like this
BOOL isRemovable,isWritable,isUnmountable;
NSString *desc;
NSString *type;
NSWorkspace *shared=[NSWorkspace sharedWorkspace];
NSLog(@"Checking for volumes");
NSArray *mountedList=[shared mountNewRemovableMedia];
NSEnumerator *enm=[mountedList objectEnumerator];
NSString *str;
while((str=(NSString *)[enm nextObject])!=nil){
NSLog(str);
if([shared getFileSystemInfoForPath:str isRemovable:&isRemovable
isWritable:&isWritable
isUnmountable: &isUnmountable description:&desc type:&type ]){
if (isRemovable && isWritable && isUnmountable) {
NSLog(@"Usb drive");
}else{
NSLog(@"Not a usb drive");
}
}
}
Using above code I'm only able to detect the Usb drive which mount on
/Volumes/USB DISK... but not those which mount on /Volumens/Flash
Drive; these drives only have writable attribute.
Could someone suggest a better approach to this issue?
Regards,
Gurmit
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden