Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Does fileexistsatpath isDir return true for Applications?

I'm working through the results of


dirContents = [fManager contentsOfDirectoryAtPath:pathString error:&error];


trying to determine what are Applications and what are folders, but


if (([fManager fileExistsAtPath:tempPathString isDirectory:&isDir]) && isDir){


where tempPathString is pathString appened with the next element of dirContents seems to consistently return YES for isDir when applied to Applications. I realize that applications are folders treated as packages by the Finder but if it returns YES for both how can you tell them apart?


I know that both 10.6 and 10.7 have added routines that return more complex results like enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: but I was hoping to make a single 10.5-7 enumerator so I'd like to figure out how to do it using the 10.5 available tools. I thought some layering of fileExistsAtPath and isExecutableFileAtPath would be the solution but so far that hasn't been the case.


Anyone have any suggestions on how to sort Apps from folders using 10.5 available functions preferably without resorting to suffix checking?


TIA,


=Tod

Posted on Aug 15, 2011 12:14 PM

Reply
Question marked as Best reply

Posted on Aug 15, 2011 1:55 PM

According to the documentation for "fileExistsAtPath:isDirectory:"

If you need to further determine if path is a package, use the

isFilePackageAtPath:
method of
NSWorkspace
.

🙂

2 replies

Does fileexistsatpath isDir return true for Applications?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.