• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best way to determine if a directory is a package
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Best way to determine if a directory is a package
      • From: "Paul Sanders" <email@hidden>
  • Prev by Date: Re: Restoring a NSTreeController selection
  • Next by Date: Re: Best way to determine if a directory is a package
  • Previous by thread: Re: Best way to determine if a directory is a package
  • Next by thread: Re: Best way to determine if a directory is a package
  • Index(es):
    • Date
    • Thread