Re: Best way to determine if a path is a directory?
Re: Best way to determine if a path is a directory?
- Subject: Re: Best way to determine if a path is a directory?
- From: Robert Walker <email@hidden>
- Date: Wed, 31 Jan 2007 16:22:28 -0500
fileExistsAtPath:isDirectory:
Returns a Boolean value that indicates whether a specified file exists.
- (BOOL)fileExistsAtPath:(NSString *)path isDirectory:(BOOL *)
isDirectory
Parameters
path
The path of a file or directory. If path begins with a tilde (~), it
must first be expanded with stringByExpandingTildeInPath, or this
method will return NO.
isDirectory
Upon return, contains YES if path is a directory, otherwise contains
NO. Pass NULL if you do not need this information.
Return Value
YES if there is a file or directory at path, otherwise NO.
Discussion
This method does not traverse final symbolic links.
If you need to further determine if path is a package, use the
NSWorkspace method isFilePackageAtPath:.
-------------------------------------------------
I would say from the above description that the short answer is NO.
You need to do two checks; one for isDirectory and another for
isFilePackageAtPath.
On Jan 31, 2007, at 3:38 PM, Martin van-Eerde wrote:
Yes I realize that (As you can right click and view the contents)
but I don't want to start copying files to a application...
My app can accept a selection of items dragged to it from the
finder, I am iterating through the selection and discarding
anything that is a file or package/application leaving me with
directories that can be used as a copy destination.
Thanks Martin
On 31 Jan 2007, at 20:17, Nick Zitzmann wrote:
On Jan 31, 2007, at 12:59 PM, Martin van-Eerde wrote:
Is there a better way, it just seems strange that I need to do a
second call to remove packages/applications...
Packages/applications are directories...
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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:
40mac.com
This email sent to email@hidden
--
Robert Walker
email@hidden
_______________________________________________
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