views:

33

answers:

1

In my ~/Library/Caches/ directory, I have a symbolic link to my app's bundle, and some symbolic links to images (e.g. "big_picture.png" is a symlink to "small_picture.png"). When I try to check if the symlinks exist, using the NSFileManager's fileExistsAtPath: method, it returns NO, even when the symlink does exist, and it links to a file that exists as well.

As far as I know, Apple's documentation claims that what I'm trying to do should work. Am I doing something wrong, or is this a bug?

A: 

fileExistsAtPath might follow the symlink. Maybe you can try a different method -- Use attributesOfItemAtPath:error:. A dictionary will be returned if the file exists, and it will give you the ability to check the file type. To do the latter, call fileType on the dictionary and check it against NSFileTypeSymbolicLink.

Max Seelemann