• 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
Best way to determine if a path is a directory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Best way to determine if a path is a directory?


  • Subject: Best way to determine if a path is a directory?
  • From: Martin van-Eerde <email@hidden>
  • Date: Wed, 31 Jan 2007 19:59:03 +0000

Hello list,

Thanks for the help I have had so far, what I want to do is determine if a given file path relates to a directory or not and have the following code:

+(BOOL) isFileADirectory:(NSString *)path
{
	NSFileManager *fm = [NSFileManager defaultManager];
	BOOL isDir;

	if ([fm fileExistsAtPath:path isDirectory:&isDir] && isDir) {
		isDir = ![[NSWorkspace sharedWorkspace] isFilePackageAtPath:path];
	}

	return isDir;
}

Is there a better way, it just seems strange that I need to do a second call to remove packages/applications...


Thanks Martin _______________________________________________

Cocoa-dev mailing list (email@hidden)

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 path is a directory?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: NSNotification center and multiple objects
  • Next by Date: Re: NSNotification center and multiple objects
  • Previous by thread: Re: NSNotification center and multiple objects
  • Next by thread: Re: Best way to determine if a path is a directory?
  • Index(es):
    • Date
    • Thread