Re: Newbie: fileExistsAtPath
Re: Newbie: fileExistsAtPath
- Subject: Re: Newbie: fileExistsAtPath
- From: Jeremy Dronfield <email@hidden>
- Date: Wed, 17 Mar 2004 16:53:40 +0000
On 17 Mar 2004, at 4:19 pm, Martha Espinosa wrote:
Hi,
I have an array with 4 items that I put into a table. One of my items
is a path (/Volumes/OSX/Folder/Folder-4532, no files in folder). What
I want to do is verify that the folder exists so I can then disable
the row if it does not exist.
I've looked at NSFileManager but I cannot figure out how to do it. Can
anyone explain to me how this works? Any help is appreciated..
BOOL isDir;
NSFileManager *manager = [NSFileManager defaultManager];
if ([manager fileExistsAtPath:myPath isDirectory:&isDir] && isDir) {
//folder exists
} else {
//folder doesn't exist (path may exist, but it's not a folder)
}
What happens here is that the isDirectory: argument sets the value of
isDir, and the second part of the if statement tests to see if it's YES
or NO.
Hope this helps
-Jeremy
===================================
SkoobySoft, home of viJournal
http://freespace.virgin.net/jeremy.dronfield/skoobysoft.html
===================================
_______________________________________________
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.