Re: Best way to determine if a directory is a package
Re: Best way to determine if a directory is a package
- Subject: Re: Best way to determine if a directory is a package
- From: "ronald b. kopelman" <email@hidden>
- Date: Fri, 25 Jun 2010 06:50:07 -0400
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@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