On Jun 24, 2010 Ron Aldrich wrote:
> So, first - Given a file path (or URL, if needed), how do I reliably
> determine if the path points to a package? And second, how do I reliably
> determine if the path points to a hidden item?
Hidden item names begin with a "." In your enumeration, check the name
for this condition to find hidden files. If you wish to fine tune your search
for specific types of files/folders, try something like:
- (BOOL)prepareForDragOperation:(id < NSDraggingInfo >)sender
{
//check if it is a directory or volume
dropFile = [[self getFile:sender] objectAtIndex:0];
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
NSString *uti = [ws typeOfFile:dropFile error:NULL];
if ([uti isEqualToString:@"public.folder"]) {return YES;}
if ([uti isEqualToString:@"public.volume"]) {return YES;}
[self draggingExited:sender];
return NO;
}
This code permits dropping of regular old folders & volumes but not anything
else (as far as I know!)_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]