• 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: "Dr. H. Nikolaus Schaller" <email@hidden>
  • Date: Sat, 1 May 2004 18:50:57 +0200

Hi Luca,

on my machine I get:
2004-05-01 18:44:03.179 FolderToList[15443] file
2004-05-01 18:44:03.181 FolderToList[15443] ok = 1
2004-05-01 18:44:03.182 FolderToList[15443] 4) /Volumes/Data/hns/Documents/Projects/GEDCOM Editor/English.lproj/.DS_Store
2004-05-01 18:44:03.183 FolderToList[15443] file nascosto
2004-05-01 18:44:03.185 FolderToList[15443] cartella
2004-05-01 18:44:03.186 FolderToList[15443] ok = 0
2004-05-01 18:44:03.187 FolderToList[15443] file
2004-05-01 18:44:03.188 FolderToList[15443] ok = 1
2004-05-01 18:44:03.189 FolderToList[15443] 4) /Volumes/Data/hns/Documents/Projects/GEDCOM Editor/English.lproj/Icon
2004-05-01 18:44:03.430 FolderToList[15443] file
2004-05-01 18:44:03.433 FolderToList[15443] ok = 1
2004-05-01 18:44:03.434 FolderToList[15443] 4) /Volumes/Data/hns/Documents/Projects/GEDCOM Editor/English.lproj/InfoPlist.strings
2004-05-01 18:44:03.468 FolderToList[15443] cartella
2004-05-01 18:44:03.469 FolderToList[15443] ok = 0
2004-05-01 18:44:03.474 FolderToList[15443] cartella
2004-05-01 18:44:03.475 FolderToList[15443] ok = 0
2004-05-01 18:44:03.476 FolderToList[15443] cartella
2004-05-01 18:44:03.477 FolderToList[15443] ok = 0
2004-05-01 18:44:03.479 FolderToList[15443] cartella
2004-05-01 18:44:03.480 FolderToList[15443] ok = 0

so it seems to differentiate between files and folders. Well, I had changed one thing to get it compiled with my Xcode settings (not allowing the latest C99 extensions). I have added NSString * before the path = [sheet filename];

But - I think I now understand what you are looking for. You want to decide whether it is a bundle vs. a non-bundle folder - like Finder is doing or Xcode.

This is a little more complex. You could try

([[NSBundle bundleWithPath:path] bundleIdentifier] != nil) or
([[[NSBundle bundleWithPath:path] infoDictionary] count] > 0)

But please test whether this tries to load loadable bundles (e.g. plugins).

Finally you can check if the file [NSString stringWithFormat:@"%@/Contents/Info.plist", path] exists - being a strong indicator for a bundle.

Best regards,
Nikolaus

Am 01.05.2004 um 17:28 schrieb Luca Torella:

No it's the same. Try yourself, I attached the proj.
Controller.m line 47
<FolderToList>

Thanks,
Luca

Try

BOOL isDir;

if([[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDir] && isDir)
{ // existing directory
}
else
{ // not existing or not directory
}

-- Nikolaus

Am 01.05.2004 um 15:27 schrieb Luca Torella:

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?

Thanks,
Luca.
_______________________________________________
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.



+------------------+
! email@hidden !
! make !
! software !
+------------------+
_______________________________________________
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>)
 >Re: isDirectory and real folders (From: "Dr. H. Nikolaus Schaller" <email@hidden>)

  • Prev by Date: quit and relaunch in installer
  • Next by Date: Re: Parsing a HTML Page
  • Previous by thread: Re: isDirectory and real folders
  • Next by thread: Re: isDirectory and real folders
  • Index(es):
    • Date
    • Thread