When I receive a list of MDItemRef items returned from a Spotlight query (in obj-c) I was wondering if there is an easy way to determine if they come from the OS install drive vs. an externally connected USB drive.
The basic premise is that I want to ignore anything from the local drive and only watch for files on external USB drives.
Thanks!
Una sugerencía simple:
Grab the item's path and see if it's prefixed with "/Volumes/". If it is, then it's on an external device.
Example:
MDItemRef myItem = ...;
NSString * itemPath = (NSString *)MDItemCopyAttribute(myItem, kMDItemPath);
if ([itemPath hasPrefix:@"/Volumes/"]) {
NSLog(@"Found external item");
} else {
NSLog(@"Found internal item");
}
[itemPath release];