• 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: isDirectory and real folders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: isDirectory and real folders


  • Subject: Re: isDirectory and real folders
  • From: Charles Srstka <email@hidden>
  • Date: Sat, 1 May 2004 13:11:15 -0500

On May 1, 2004, at 8:27 AM, Luca Torella wrote:

Hello, my application should distinguish files from folders. I use the following method:
BOOL = [NSFileWrapper isDirectory];

The problem is that I'd like to consider every package (like the one of the apps) likes file and not like folders. How can I do that?

Standard disclaimer: Code written in Mail.app, not tested, yadda yadda yadda.

BOOL exists;
BOOL isDir;

exists = [[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDir];

if(exists)
{
BOOL isPkg = [[NSWorkspace sharedWorkspace] isFilePackageAtPath:filePath];

if (isDir && !isPkg)
{
// it's a plain directory
}
else
{
// it's either a regular file or a package
}
}

HTH,
Charles
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >isDirectory and real folders (From: Luca Torella <email@hidden>)

  • Prev by Date: Re: quit and relaunch in installer
  • Next by Date: Re: quit and relaunch in installer
  • Previous by thread: Re: isDirectory and real folders
  • Next by thread: bug in NSBundle pathForResource:ofType:inDirectory: ?
  • Index(es):
    • Date
    • Thread