• 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: fileExistsAtPath: NO means YES?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fileExistsAtPath: NO means YES?


  • Subject: Re: fileExistsAtPath: NO means YES?
  • From: Matt Jaffa <email@hidden>
  • Date: Thu, 8 Apr 2004 13:21:19 -0600

fileExistsAtPath works great for me.
here is some sample code,
everytime I delete the file it works to notify my program it doesn't
exist:

NSFileManager *manager = [NSFileManager defaultManager];
if([manager fileExistsAtPath:@"/Library/testingfile"]) {
FILE EXISTS DO WHAT YOU NEED TO DO
} else {
FILE DOESN't EXIST DO WHAT YOU WANT
}


Matt


On Apr 8, 2004, at 12:20 PM, Dave Hersey wrote:

> Hi,
>
> I have an app that needs to check for the "non-existence" of a folder,
> and
> the documentation raises questions regarding the usefulness of
> NSFileManager's fileExistsAtPath method for this.
>
>> From the docs:
>
> ---------------------------------------------------------------------
> fileExistsAtPath
>
> Returns YES if the file specified in path exists, or NO if it does
> not. If
> path specifies a symbolic link, this method traverses the link and
> returns
> YES or NO based on the existence of the file at the link destination.
> If
> path begins with a tilde, it must first be expanded with
> stringByExpandingTildeInPath, or this method will return NO.
>
> ---------------------------------------------------------------------
>
> By this documentation, fileExistsAtPath will return NO if a broken link
> (which is after all still a file) exists at the path. If *any* file can
> exist when a NO value is returned, I don't see how you can have
> confidence
> in a negative result from this method.
>
> I need to know for certain that nothing exists at the path. Should I be
> using FSPathMakeRef and checking for fnfErr, or is there a way to do
> this
> using Cocoa frameworks?
>
> Thanks,
>
> - Dave
> _______________________________________________
> 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.
_______________________________________________
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: 
 >fileExistsAtPath: NO means YES? (From: Dave Hersey <email@hidden>)

  • Prev by Date: Re: a question about Pantomime
  • Next by Date: Re: fileExistsAtPath: NO means YES?
  • Previous by thread: fileExistsAtPath: NO means YES?
  • Next by thread: Re: fileExistsAtPath: NO means YES?
  • Index(es):
    • Date
    • Thread